summaryrefslogtreecommitdiff
path: root/Build/source/texk/mendexk/pageread.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2012-07-28 10:09:46 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2012-07-28 10:09:46 +0000
commit2c71c9d92117f7f1fe0d5bd6fe74922e50be0c86 (patch)
tree6581f8e2c781693a75e6eabb32df88f8299fe1a2 /Build/source/texk/mendexk/pageread.c
parentbb3913a1553c1213f93e6f10185f770cde5ae901 (diff)
mendexk: Use Nelson Beebe's qqsort() instead of qsort()
Handle input files with Dos/Windows (CRLF) line endings (from W32TeX) Always use KPATHSEA. Use xmalloc() and xstrdup() git-svn-id: svn://tug.org/texlive/trunk@27216 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/mendexk/pageread.c')
-rw-r--r--Build/source/texk/mendexk/pageread.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Build/source/texk/mendexk/pageread.c b/Build/source/texk/mendexk/pageread.c
index 8b16e892d7a..1d6f574395b 100644
--- a/Build/source/texk/mendexk/pageread.c
+++ b/Build/source/texk/mendexk/pageread.c
@@ -5,6 +5,21 @@
#include <kpathsea/tex-file.h>
#include "mendex.h"
+static inline int
+bfgetc (FILE *stream)
+{
+ int cc = getc (stream);
+ if (cc == '\r') {
+ cc = getc (stream);
+ if (cc != '\n') {
+ ungetc (cc, stream);
+ cc = '\r';
+ }
+ }
+ return cc;
+}
+#define fgetc bfgetc
+
/* checking last page */
int lastpage(const char *filename)
{