* Ignore CR in CRLF line terminators for compatibility with DOSsy
authorPaul Smith <psmith@gnu.org>
Wed, 31 Mar 1999 23:25:13 +0000 (23:25 +0000)
committerPaul Smith <psmith@gnu.org>
Wed, 31 Mar 1999 23:25:13 +0000 (23:25 +0000)
  makefiles.

ChangeLog
NEWS
read.c

index b7b1b8542e54e4688b88e70c687b6576b9d66ff3..aeba3427fa2f56e3ff6e2d5ab0174be0473333ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1999-03-31  Paul D. Smith  <psmith@gnu.org>
+
+       * read.c (readline): Ignore carriage returns at the end of the
+       line, to allow Windows-y CRLF line terminators.
+
 1999-03-30  Paul D. Smith  <psmith@gnu.org>
 
        * configure.in: Don't put build.sh here, since build.sh.in doesn't
diff --git a/NEWS b/NEWS
index c7044b6b1126e184356a53b613f47d4bcbbaadda..4b6978fccbf7f88ac3777964a81107cf361e81c1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 GNU make NEWS                                               -*-indented-text-*-
   History of user-visible changes.
-  22 Mar 1999
+  31 Mar 1999
 
 Copyright (C) 1992,93,94,95,96,97,98,1999 Free Software Foundation, Inc.
 See the end for copying conditions.
@@ -21,6 +21,9 @@ Version 3.78
 * Make defines a new variable, .LIBPATTERNS.  This variable controls how
   the link library dependency expansion (dependencies like ``-lfoo'') is
   performed.
+
+* Make allows CRLF sequences as well as traditional LF, in makefiles for
+  UNIX.
 \f
 Version 3.77
 
@@ -682,7 +685,3 @@ Copyright information:
    Permission is granted to distribute modified versions of this
    document, or of portions of it, under the above conditions, provided
    also that they carry prominent notices stating who last changed them.
-\f
-Local variables:
-version-control: never
-end:
diff --git a/read.c b/read.c
index 1ce892d0f65c2df96883a21b98ec572345d520ab..1b340ac4f8d25dfbe23a84ebf7bc4d0729496269 100644 (file)
--- a/read.c
+++ b/read.c
@@ -2129,6 +2129,17 @@ readline (linebuffer, stream, flocp)
 
       ++nlines;
 
+#if !defined(WINDOWS32) && !defined(__MSDOS__)
+      /* Check to see if the line was really ended with CRLF; if so ignore
+         the CR.  */
+      if (len > 1 && p[-2] == '\r')
+        {
+          --len;
+          --p;
+          p[-1] = '\n';
+        }
+#endif
+
       if (len == 1 && p > buffer)
        /* P is pointing at a newline and it's the beginning of
           the buffer returned by the last fgets call.  However,