summaryrefslogtreecommitdiff
path: root/Build/source/texk/makeindexk/mkind.c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-11-02 00:00:01 +0000
committerKarl Berry <karl@freefriends.org>2010-11-02 00:00:01 +0000
commita9b2a790f635e283433247b2b347c67274c6d2b8 (patch)
tree61f0b5c9604c8a02b2e512cb804151effe545a80 /Build/source/texk/makeindexk/mkind.c
parent5c7ef6068414bffac572f3d5b0926e6c100628d2 (diff)
accept both LF and CRLF; from Taco
git-svn-id: svn://tug.org/texlive/trunk@20290 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/makeindexk/mkind.c')
-rw-r--r--Build/source/texk/makeindexk/mkind.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Build/source/texk/makeindexk/mkind.c b/Build/source/texk/makeindexk/mkind.c
index 60c292fc7d0..754fe771f83 100644
--- a/Build/source/texk/makeindexk/mkind.c
+++ b/Build/source/texk/makeindexk/mkind.c
@@ -78,6 +78,22 @@ static void process_idx (char * *fn,int use_stdin,int sty_given,
long totmem = 0L; /* for debugging memory usage */
#endif /* DEBUG */
+/* |mk_getc|: accept either Unix or Windows line endings */
+
+static int lookahead = -2; /* because you can't ungetc(EOF) */
+
+int
+mk_getc(FILE *stream)
+{
+ int ch = (lookahead != -2 ? lookahead : getc(stream));
+ lookahead = (ch == '\r' ? getc(stream) : -2);
+ if (lookahead == LFD) {
+ ch = lookahead;
+ lookahead = -2;
+ }
+ return ch;
+}
+
int
main(int argc, char *argv[])
{