summaryrefslogtreecommitdiff
path: root/read.c
diff options
context:
space:
mode:
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,