summaryrefslogtreecommitdiff
path: root/lib-src/sorted-doc.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2006-06-03 14:51:25 +0000
committerEli Zaretskii <eliz@gnu.org>2006-06-03 14:51:25 +0000
commite75dcee327e6ece31d765beff38f6784745c87ce (patch)
treee834eedaccc391ac2cc9bf17620a63d1c9cd7020 /lib-src/sorted-doc.c
parentc61bea765d6511d69f8e0eb023e071a47b73122d (diff)
downloademacs-e75dcee327e6ece31d765beff38f6784745c87ce.tar.gz
[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.
Diffstat (limited to 'lib-src/sorted-doc.c')
-rw-r--r--lib-src/sorted-doc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c
index 0a06aa2c984..67bddbc3304 100644
--- a/lib-src/sorted-doc.c
+++ b/lib-src/sorted-doc.c
@@ -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 @@ 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 */