From e03d9b4d20944d17e4e2b70abda32e625679e374 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 15 Nov 2013 22:30:57 +0000 Subject: Fix a bug in mfgets in mendexk git-svn-id: svn://tug.org/texlive/trunk@32155 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/mendexk/ChangeLog | 5 +++++ Build/source/texk/mendexk/fread.c | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'Build') diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog index 7227d6ebb22..65d0b948642 100644 --- a/Build/source/texk/mendexk/ChangeLog +++ b/Build/source/texk/mendexk/ChangeLog @@ -1,3 +1,8 @@ +2013-11-15 Akira Kakuto + + * fread.c: Discard the final '\n' in DOS line endings in mfgets(), + because dictionary files with DOS line endings can't be read. + 2013-09-10 Peter Breitenlohner * fwrite.c: Bug fix as suggested by Akira, Karl, and Norbert. diff --git a/Build/source/texk/mendexk/fread.c b/Build/source/texk/mendexk/fread.c index 0ae9151ffb1..8a1e5559f6d 100644 --- a/Build/source/texk/mendexk/fread.c +++ b/Build/source/texk/mendexk/fread.c @@ -523,6 +523,11 @@ char *mfgets(char *buf, int size, FILE *fp) int c, len; if ((len = input_line2(fp, (unsigned char *) buf, 0, size, &c)) == 0) return NULL; + if (c == '\r') { + int cc = getc(fp); + if (cc != '\n') + ungetc(cc, fp); + } if (c == '\n' || c == '\r') { if (len+1 < size) strcat(buf+len, "\n"); else ungetc(c, fp); -- cgit v1.2.3