summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2013-11-16 01:06:02 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2013-11-16 01:06:02 +0000
commit96cf268a3b4d66e23f1f9832004a2a90af37a766 (patch)
tree36509820b6f4218a23e24062dee0c6bd2f66c55a
parente03d9b4d20944d17e4e2b70abda32e625679e374 (diff)
Fix a bug in fread.c (mendexk)
git-svn-id: svn://tug.org/texlive/trunk@32156 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/mendexk/ChangeLog4
-rw-r--r--Build/source/texk/mendexk/fread.c8
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 <kakuto@fuk.kindai.ac.jp>
+2013-11-16 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
- * 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 <peb@mppmu.mpg.de>
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);