# HG changeset patch # User Eli Zaretskii # Date 1149346285 0 # Node ID fa429804cb9609ec4a80d760ae176db0ab98fc0c # Parent 26720075d7492afd84ac8d390012c33547b545d0 [DOS_NT] : Include fcntl.h and io.h. [WINDOWSNT] : Don't redeclare malloc. (main) [DOS_NT]: Switch stdin to binary mode, if it is not a terminal device. diff -r 26720075d749 -r fa429804cb96 lib-src/sorted-doc.c --- a/lib-src/sorted-doc.c Sat Jun 03 13:54:26 2006 +0000 +++ b/lib-src/sorted-doc.c Sat Jun 03 14:51:25 2006 +0000 @@ -29,9 +29,15 @@ #include #include +#ifdef DOS_NT +#include /* for O_BINARY */ +#include /* for setmode */ +#endif #ifndef HAVE_STDLIB_H /* config.h includes stdlib. */ +#ifndef WINDOWSNT /* src/s/ms-w32.h includes stdlib.h */ extern char *malloc (); #endif +#endif #define NUL '\0' #define MARKER '\037' @@ -134,6 +140,12 @@ DOCSTR *docs = NULL; /* chain of allocated DOCSTRS */ char buf[512]; /* line buffer */ +#ifdef DOS_NT + /* DOC is a binary file. */ + if (!isatty (fileno (stdin))) + setmode (fileno (stdin), O_BINARY); +#endif + while (1) /* process one char at a time */ { /* this char from the DOCSTR file */