From 96cf268a3b4d66e23f1f9832004a2a90af37a766 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sat, 16 Nov 2013 01:06:02 +0000 Subject: Fix a bug in fread.c (mendexk) git-svn-id: svn://tug.org/texlive/trunk@32156 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/mendexk/ChangeLog | 4 ++-- Build/source/texk/mendexk/fread.c | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog index 65d0b948642..5e09044ca6c 100644 --- a/Build/source/texk/mendexk/ChangeLog +++ b/Build/source/texk/mendexk/ChangeLog @@ -1,6 +1,6 @@ -2013-11-15 Akira Kakuto +2013-11-16 Akira Kakuto - * fread.c: Discard the final '\n' in DOS line endings in mfgets(), + * fread.c: Allow lines with only a line ending in mfgets(), because dictionary files with DOS line endings can't be read. 2013-09-10 Peter Breitenlohner diff --git a/Build/source/texk/mendexk/fread.c b/Build/source/texk/mendexk/fread.c index 8a1e5559f6d..e183bca11a4 100644 --- a/Build/source/texk/mendexk/fread.c +++ b/Build/source/texk/mendexk/fread.c @@ -522,12 +522,8 @@ 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 ((len = input_line2(fp, (unsigned char *) buf, 0, size, &c)) == 0 + && c != '\r' && c != '\n') return NULL; if (c == '\n' || c == '\r') { if (len+1 < size) strcat(buf+len, "\n"); else ungetc(c, fp); -- cgit v1.2.3