Commit e75dcee3 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

[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.
parent c61bea76
...@@ -29,9 +29,15 @@ ...@@ -29,9 +29,15 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.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 HAVE_STDLIB_H /* config.h includes stdlib. */
#ifndef WINDOWSNT /* src/s/ms-w32.h includes stdlib.h */
extern char *malloc (); extern char *malloc ();
#endif #endif
#endif
#define NUL '\0' #define NUL '\0'
#define MARKER '\037' #define MARKER '\037'
...@@ -134,6 +140,12 @@ main () ...@@ -134,6 +140,12 @@ main ()
DOCSTR *docs = NULL; /* chain of allocated DOCSTRS */ DOCSTR *docs = NULL; /* chain of allocated DOCSTRS */
char buf[512]; /* line buffer */ 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 */ while (1) /* process one char at a time */
{ {
/* this char from the DOCSTR file */ /* this char from the DOCSTR file */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment