diff lib-src/make-docfile.c @ 25532:9ed9cbc425fe

Include config.h not ../src/config.h. (main, fopen, chdir): Add #undef. (read_c_string, scan_c_file, skip_white, read_lisp_symbol) (scan_lisp_file): Handle \r like \n.
author Richard M. Stallman <rms@gnu.org>
date Fri, 03 Sep 1999 23:12:27 +0000
parents 7ebe942c4a9c
children 2cfdaebe325c
line wrap: on
line diff
--- a/lib-src/make-docfile.c	Fri Sep 03 22:45:43 1999 +0000
+++ b/lib-src/make-docfile.c	Fri Sep 03 23:12:27 1999 +0000
@@ -33,7 +33,12 @@
  */
 
 #define NO_SHORTNAMES   /* Tell config not to load remap.h */
-#include <../src/config.h>
+#include <config.h>
+
+/* defined to be emacs_main, sys_fopen, etc. in config.h */
+#undef main
+#undef fopen
+#undef chdir
 
 #include <stdio.h>
 #ifdef MSDOS
@@ -219,7 +224,7 @@
 	  if (c == '\\')
 	    {
 	      c = getc (infile);
-	      if (c == '\n')
+	      if (c == '\n' || c == '\r')
 		{
 		  c = getc (infile);
 		  continue;
@@ -367,7 +372,7 @@
   c = '\n';
   while (!feof (infile))
     {
-      if (c != '\n')
+      if (c != '\n' && c != '\r')
 	{
 	  c = getc (infile);
 	  continue;
@@ -450,7 +455,7 @@
 		{
 		  do
 		    c = getc (infile);
-		  while (c == ' ' || c == '\n' || c == '\t');
+		  while (c == ' ' || c == '\n' || c == '\r' || c == '\t');
 		  if (c < 0)
 		    goto eof;
 		  ungetc (c, infile);
@@ -467,14 +472,14 @@
 	    goto eof;
 	  c = getc (infile);
 	}
-      while (c == ' ' || c == '\n' || c == '\t')
+      while (c == ' ' || c == '\n' || c == '\r' || c == '\t')
 	c = getc (infile);
       if (c == '"')
 	c = read_c_string (infile, 0);
       while (c != ',')
 	c = getc (infile);
       c = getc (infile);
-      while (c == ' ' || c == '\n' || c == '\t')
+      while (c == ' ' || c == '\n' || c == '\r' || c == '\t')
 	c = getc (infile);
 
       if (c == '"')
@@ -558,7 +563,7 @@
      FILE *infile;
 {
   char c = ' ';
-  while (c == ' ' || c == '\t' || c == '\n')
+  while (c == ' ' || c == '\t' || c == '\n' || c == '\r')
     c = getc (infile);
   ungetc (c, infile);
 }
@@ -577,7 +582,7 @@
       c = getc (infile);
       if (c == '\\')
 	*(++fillp) = getc (infile);
-      else if (c == ' ' || c == '\t' || c == '\n' || c == '(' || c == ')')
+      else if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '(' || c == ')')
 	{
 	  ungetc (c, infile);
 	  *fillp = 0;
@@ -614,7 +619,7 @@
       char buffer[BUFSIZ];
       char type;
 
-      if (c != '\n')
+      if (c != '\n' && c != '\r')
 	{
 	  c = getc (infile);
 	  continue;
@@ -654,7 +659,7 @@
 	      saved_string[length - 1] = 0;
 	      /* Skip the newline.  */
 	      c = getc (infile);
-	      while (c != '\n')
+	      while (c != '\n' && c != '\r')
 		c = getc (infile);
 	    }
 	  continue;
@@ -700,7 +705,7 @@
 	   */
 	  if ((c = getc (infile)) != '"' ||
 	      (c = getc (infile)) != '\\' ||
-	      (c = getc (infile)) != '\n')
+	      (c = getc (infile)) != '\n' || c != '\r')
 	    {
 #ifdef DEBUG
 	      fprintf (stderr, "## non-docstring in %s (%s)\n",
@@ -721,7 +726,7 @@
 	    {
 
 	      /* Skip until the first newline; remember the two previous chars. */
-	      while (c != '\n' && c >= 0)
+	      while (c != '\n' && c != '\r' && c >= 0)
 		{
 		  c2 = c1;
 		  c1 = c;
@@ -781,7 +786,7 @@
 	    {
 	      /* Skip until the first newline; remember the two previous
 		 chars. */
-	      while (c != '\n' && c >= 0)
+	      while (c != '\n' && c != '\r' && c >= 0)
 		{
 		  c2 = c1;
 		  c1 = c;
@@ -838,7 +843,7 @@
 	  if (saved_string == 0)
 	    {
 	      /* Skip until the first newline; remember the two previous chars. */
-	      while (c != '\n' && c >= 0)
+	      while (c != '\n' && c != '\r' && c >= 0)
 		{
 		  c2 = c1;
 		  c1 = c;
@@ -905,7 +910,7 @@
 		 then we're not reading a docstring.  */
 	      if ((c = getc (infile)) != '"' ||
 		  (c = getc (infile)) != '\\' ||
-		  (c = getc (infile)) != '\n')
+		  (c = getc (infile)) != '\n' || c != '\r')
 		{
 #ifdef DEBUG
 		  fprintf (stderr, "## non-docstring in %s (%s)\n",