summaryrefslogtreecommitdiff
path: root/Build/source/texk/mendexk
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2013-11-15 22:30:57 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2013-11-15 22:30:57 +0000
commite03d9b4d20944d17e4e2b70abda32e625679e374 (patch)
treed591821345c8bd3c09c20a39994ab7aaf14b6a14 /Build/source/texk/mendexk
parent951104ef47e1244c000f8569dabdc45f0133f6aa (diff)
Fix a bug in mfgets in mendexk
git-svn-id: svn://tug.org/texlive/trunk@32155 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/mendexk')
-rw-r--r--Build/source/texk/mendexk/ChangeLog5
-rw-r--r--Build/source/texk/mendexk/fread.c5
2 files changed, 10 insertions, 0 deletions
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 <kakuto@fuk.kindai.ac.jp>
+
+ * 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 <peb@mppmu.mpg.de>
* 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);