]> git.eshelyaron.com Git - emacs.git/commitdiff
[DOS_NT] <top level>: Include fcntl.h and io.h.
authorEli Zaretskii <eliz@gnu.org>
Sat, 3 Jun 2006 14:51:25 +0000 (14:51 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 3 Jun 2006 14:51:25 +0000 (14:51 +0000)
[WINDOWSNT] <top level>: Don't redeclare malloc.
(main) [DOS_NT]: Switch stdin to binary mode, if it is not a terminal device.

lib-src/sorted-doc.c

index 0a06aa2c984caf571f42ec7f15dacb20bd149f10..67bddbc3304dc58e27f2e511f06d65d5d59b5b22 100644 (file)
 
 #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 @@ main ()
   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 */