comparison lib-src/make-docfile.c @ 410:de805c49cfc1 r21-2-35

Import from CVS: tag r21-2-35
author cvs
date Mon, 13 Aug 2007 11:19:21 +0200
parents 501cfd01ee6d
children 697ef44129c6
comparison
equal deleted inserted replaced
409:301b9ebbdf3b 410:de805c49cfc1
44 44
45 #include <stdio.h> 45 #include <stdio.h>
46 #include <errno.h> 46 #include <errno.h>
47 #if __STDC__ || defined(STDC_HEADERS) 47 #if __STDC__ || defined(STDC_HEADERS)
48 #include <stdlib.h> 48 #include <stdlib.h>
49 #ifdef HAVE_UNISTD_H
49 #include <unistd.h> 50 #include <unistd.h>
51 #endif
50 #include <string.h> 52 #include <string.h>
51 #include <ctype.h> 53 #include <ctype.h>
52 #endif 54 #endif
53 55
54 #if defined(MSDOS) || defined(__CYGWIN32__) 56 #ifdef CYGWIN
55 #include <fcntl.h> 57 #include <fcntl.h>
56 #endif /* MSDOS */ 58 #endif
57 #ifdef WINDOWSNT 59 #ifdef WIN32_NATIVE
58 #include <direct.h> 60 #include <direct.h>
59 #include <fcntl.h> 61 #include <fcntl.h>
60 #include <io.h> 62 #include <io.h>
61 #include <stdlib.h> 63 #include <stdlib.h>
62 #endif /* WINDOWSNT */ 64 #endif /* WIN32_NATIVE */
63 65
66 #ifndef WIN32_NATIVE
64 #include <sys/param.h> 67 #include <sys/param.h>
65 68 #endif /* not WIN32_NATIVE */
66 #if defined(DOS_NT) || defined(__CYGWIN32__) 69
70 #if defined(WIN32_NATIVE) || defined(CYGWIN)
67 #define READ_TEXT "rt" 71 #define READ_TEXT "rt"
68 #define READ_BINARY "rb" 72 #define READ_BINARY "rb"
69 #define WRITE_BINARY "wb" 73 #define WRITE_BINARY "wb"
70 #define APPEND_BINARY "ab" 74 #define APPEND_BINARY "ab"
71 #else /* not DOS_NT */ 75 #else /* not WIN32_NATIVE */
72 #define READ_TEXT "r" 76 #define READ_TEXT "r"
73 #define READ_BINARY "r" 77 #define READ_BINARY "r"
74 #define WRITE_BINARY "w" 78 #define WRITE_BINARY "w"
75 #define APPEND_BINARY "a" 79 #define APPEND_BINARY "a"
76 #endif /* not DOS_NT */ 80 #endif /* not WIN32_NATIVE */
77
78 #ifdef MSDOS
79 /* s/msdos.h defines this as sys_chdir, but we're not linking with the
80 file where that function is defined. */
81 #undef chdir
82 #endif
83 81
84 /* Stdio stream for output to the DOC file. */ 82 /* Stdio stream for output to the DOC file. */
85 static FILE *outfile; 83 static FILE *outfile;
86 84
87 enum 85 enum
189 progname = argv[0]; 187 progname = argv[0];
190 188
191 outfile = stdout; 189 outfile = stdout;
192 190
193 /* Don't put CRs in the DOC file. */ 191 /* Don't put CRs in the DOC file. */
194 #ifdef MSDOS 192 #ifdef WIN32_NATIVE
195 _fmode = O_BINARY;
196 #if 0 /* Suspicion is that this causes hanging.
197 So instead we require people to use -o on MSDOS. */
198 (stdout)->_flag &= ~_IOTEXT;
199 _setmode (fileno (stdout), O_BINARY);
200 #endif
201 outfile = 0;
202 #endif /* MSDOS */
203 #ifdef WINDOWSNT
204 _fmode = O_BINARY; 193 _fmode = O_BINARY;
205 _setmode (fileno (stdout), O_BINARY); 194 _setmode (fileno (stdout), O_BINARY);
206 #endif /* WINDOWSNT */ 195 #endif /* WIN32_NATIVE */
207 196
208 /* If first two args are -o FILE, output to FILE. */ 197 /* If first two args are -o FILE, output to FILE. */
209 i = 1; 198 i = 1;
210 if (argc > i + 1 && !strcmp (argv[i], "-o")) 199 if (argc > i + 1 && !strcmp (argv[i], "-o"))
211 { 200 {