diff options
| author | Richard M. Stallman | 1994-01-06 03:59:30 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-01-06 03:59:30 +0000 |
| commit | e3938952c8d4ee2cce537b80d68f38b5fee92249 (patch) | |
| tree | 41eb20125f266e83e88a17f73018717164aba062 /lib-src | |
| parent | c6880c90ff2d2182c472976eab875d4c01481ee3 (diff) | |
| download | emacs-e3938952c8d4ee2cce537b80d68f38b5fee92249.tar.gz emacs-e3938952c8d4ee2cce537b80d68f38b5fee92249.zip | |
[MSDOS]: Use text/binary mode as appropriate.
(scan_c_file, scan_lisp_file): Extra parameter for the mode to open with.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/make-docfile.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index b038415deed..366c784075f 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Generate doc-string file for GNU Emacs from source files. | 1 | /* Generate doc-string file for GNU Emacs from source files. |
| 2 | Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc. | 2 | Copyright (C) 1985, 1986, 1992, 1993 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -32,6 +32,17 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | #include <stdio.h> | 34 | #include <stdio.h> |
| 35 | #ifdef MSDOS | ||
| 36 | #include <fcntl.h> | ||
| 37 | #endif /* MSDOS */ | ||
| 38 | |||
| 39 | #ifdef MSDOS | ||
| 40 | #define READ_TEXT "rt" | ||
| 41 | #define READ_BINARY "rb" | ||
| 42 | #else /* not MSDOS */ | ||
| 43 | #define READ_TEXT "r" | ||
| 44 | #define READ_BINARY "r" | ||
| 45 | #endif /* not MSDOS */ | ||
| 35 | 46 | ||
| 36 | FILE *outfile; | 47 | FILE *outfile; |
| 37 | 48 | ||
| @@ -42,6 +53,11 @@ main (argc, argv) | |||
| 42 | int i; | 53 | int i; |
| 43 | int err_count = 0; | 54 | int err_count = 0; |
| 44 | 55 | ||
| 56 | #ifdef MSDOS | ||
| 57 | _fmode = O_BINARY; /* all of files are treated as binary files */ | ||
| 58 | (stdout)->_flag &= ~_IOTEXT; | ||
| 59 | _setmode (fileno (stdout), O_BINARY); | ||
| 60 | #endif /* MSDOS */ | ||
| 45 | outfile = stdout; | 61 | outfile = stdout; |
| 46 | 62 | ||
| 47 | /* If first two args are -o FILE, output to FILE. */ | 63 | /* If first two args are -o FILE, output to FILE. */ |
| @@ -77,11 +93,11 @@ scan_file (filename) | |||
| 77 | { | 93 | { |
| 78 | int len = strlen (filename); | 94 | int len = strlen (filename); |
| 79 | if (!strcmp (filename + len - 4, ".elc")) | 95 | if (!strcmp (filename + len - 4, ".elc")) |
| 80 | return scan_lisp_file (filename); | 96 | return scan_lisp_file (filename, READ_BINARY); |
| 81 | else if (!strcmp (filename + len - 3, ".el")) | 97 | else if (!strcmp (filename + len - 3, ".el")) |
| 82 | return scan_lisp_file (filename); | 98 | return scan_lisp_file (filename, READ_TEXT); |
| 83 | else | 99 | else |
| 84 | return scan_c_file (filename); | 100 | return scan_c_file (filename, READ_TEXT); |
| 85 | } | 101 | } |
| 86 | 102 | ||
| 87 | char buf[128]; | 103 | char buf[128]; |
| @@ -211,8 +227,8 @@ write_c_args (out, buf, minargs, maxargs) | |||
| 211 | Looks for DEFUN constructs such as are defined in ../src/lisp.h. | 227 | Looks for DEFUN constructs such as are defined in ../src/lisp.h. |
| 212 | Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ | 228 | Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ |
| 213 | 229 | ||
| 214 | scan_c_file (filename) | 230 | scan_c_file (filename, mode) |
| 215 | char *filename; | 231 | char *filename, *mode; |
| 216 | { | 232 | { |
| 217 | FILE *infile; | 233 | FILE *infile; |
| 218 | register int c; | 234 | register int c; |
| @@ -225,7 +241,7 @@ scan_c_file (filename) | |||
| 225 | if (filename[strlen (filename) - 1] == 'o') | 241 | if (filename[strlen (filename) - 1] == 'o') |
| 226 | filename[strlen (filename) - 1] = 'c'; | 242 | filename[strlen (filename) - 1] = 'c'; |
| 227 | 243 | ||
| 228 | infile = fopen (filename, "r"); | 244 | infile = fopen (filename, mode); |
| 229 | 245 | ||
| 230 | /* No error if non-ex input file */ | 246 | /* No error if non-ex input file */ |
| 231 | if (infile == NULL) | 247 | if (infile == NULL) |
| @@ -458,13 +474,13 @@ read_lisp_symbol (infile, buffer) | |||
| 458 | } | 474 | } |
| 459 | 475 | ||
| 460 | 476 | ||
| 461 | scan_lisp_file (filename) | 477 | scan_lisp_file (filename, mode) |
| 462 | char *filename; | 478 | char *filename, *mode; |
| 463 | { | 479 | { |
| 464 | FILE *infile; | 480 | FILE *infile; |
| 465 | register int c; | 481 | register int c; |
| 466 | 482 | ||
| 467 | infile = fopen (filename, "r"); | 483 | infile = fopen (filename, mode); |
| 468 | if (infile == NULL) | 484 | if (infile == NULL) |
| 469 | { | 485 | { |
| 470 | perror (filename); | 486 | perror (filename); |