changeset 71192:fa429804cb96

[DOS_NT] <top level>: Include fcntl.h and io.h. [WINDOWSNT] <top level>: Don't redeclare malloc. (main) [DOS_NT]: Switch stdin to binary mode, if it is not a terminal device.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 03 Jun 2006 14:51:25 +0000
parents 26720075d749
children f23de50377f4
files lib-src/sorted-doc.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 <stdio.h>
 #include <ctype.h>
+#ifdef DOS_NT
+#include <fcntl.h>		/* for O_BINARY */
+#include <io.h>			/* 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 */