changeset 5449:296db649863d

[MSDOS]: Use text/binary mode as appropriate. (scan_c_file, scan_lisp_file): Extra parameter for the mode to open with.
author Richard M. Stallman <rms@gnu.org>
date Thu, 06 Jan 1994 03:59:30 +0000
parents 18de002e47dd
children 9c57cdb2091e
files lib-src/make-docfile.c
diffstat 1 files changed, 26 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/make-docfile.c	Thu Jan 06 03:58:35 1994 +0000
+++ b/lib-src/make-docfile.c	Thu Jan 06 03:59:30 1994 +0000
@@ -1,5 +1,5 @@
 /* Generate doc-string file for GNU Emacs from source files.
-   Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1992, 1993 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -32,6 +32,17 @@
  */
 
 #include <stdio.h>
+#ifdef MSDOS
+#include <fcntl.h>
+#endif /* MSDOS */
+
+#ifdef MSDOS
+#define READ_TEXT "rt"
+#define READ_BINARY "rb"
+#else /* not MSDOS */
+#define READ_TEXT "r"
+#define READ_BINARY "r"
+#endif /* not MSDOS */
 
 FILE *outfile;
 
@@ -42,6 +53,11 @@
   int i;
   int err_count = 0;
 
+#ifdef MSDOS
+  _fmode = O_BINARY;	/* all of files are treated as binary files */
+  (stdout)->_flag &= ~_IOTEXT;
+  _setmode (fileno (stdout), O_BINARY);
+#endif /* MSDOS */
   outfile = stdout;
 
   /* If first two args are -o FILE, output to FILE.  */
@@ -77,11 +93,11 @@
 {
   int len = strlen (filename);
   if (!strcmp (filename + len - 4, ".elc"))
-    return scan_lisp_file (filename);
+    return scan_lisp_file (filename, READ_BINARY);
   else if (!strcmp (filename + len - 3, ".el"))
-    return scan_lisp_file (filename);
+    return scan_lisp_file (filename, READ_TEXT);
   else
-    return scan_c_file (filename);
+    return scan_c_file (filename, READ_TEXT);
 }
 
 char buf[128];
@@ -211,8 +227,8 @@
    Looks for DEFUN constructs such as are defined in ../src/lisp.h.
    Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED.  */
 
-scan_c_file (filename)
-     char *filename;
+scan_c_file (filename, mode)
+     char *filename, *mode;
 {
   FILE *infile;
   register int c;
@@ -225,7 +241,7 @@
   if (filename[strlen (filename) - 1] == 'o')
     filename[strlen (filename) - 1] = 'c';
 
-  infile = fopen (filename, "r");
+  infile = fopen (filename, mode);
 
   /* No error if non-ex input file */
   if (infile == NULL)
@@ -458,13 +474,13 @@
 }
 
 
-scan_lisp_file (filename)
-     char *filename;
+scan_lisp_file (filename, mode)
+     char *filename, *mode;
 {
   FILE *infile;
   register int c;
 
-  infile = fopen (filename, "r");
+  infile = fopen (filename, mode);
   if (infile == NULL)
     {
       perror (filename);