summaryrefslogtreecommitdiff
path: root/read.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-03-31 23:25:13 +0000
committerPaul Smith <psmith@gnu.org>1999-03-31 23:25:13 +0000
commit7052a5715236b84ebe0b3011c4de75ce19c4ab5d (patch)
tree5b401afcb479f81fee107132c12ef745991f6579 /read.c
parent47922a5a659bfe49976bae8f9ce1e11a23006d29 (diff)
downloadgunmake-7052a5715236b84ebe0b3011c4de75ce19c4ab5d.tar.gz
* Ignore CR in CRLF line terminators for compatibility with DOSsy
makefiles.
Diffstat (limited to 'read.c')
-rw-r--r--read.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/read.c b/read.c
index 1ce892d..1b340ac 100644
--- 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,