aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Heffner <mikeh@FreeBSD.org>2001-05-11 03:07:11 +0000
committerMike Heffner <mikeh@FreeBSD.org>2001-05-11 03:07:11 +0000
commitafa3a100e9ce3215c52b0c7e907a4229f46d8df2 (patch)
tree8b5bdbf15b3c1093de4fc2767d7097826ba0efa1
parent66b166c9948559c62bbe973d1b83fc4fe764adc2 (diff)
Notes
-rw-r--r--usr.bin/mail/fio.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.bin/mail/fio.c b/usr.bin/mail/fio.c
index 2bf99633a039..fe6480a07a9a 100644
--- a/usr.bin/mail/fio.c
+++ b/usr.bin/mail/fio.c
@@ -94,6 +94,16 @@ setptr(ibuf)
return;
}
count = strlen(linebuf);
+ /*
+ * Transforms lines ending in <CR><LF> to just <LF>.
+ * This allows mail to be able to read Eudora mailboxes.
+ */
+ if (count >= 2 && linebuf[count - 1] == '\n' &&
+ linebuf[count - 2] == '\r') {
+ count--;
+ linebuf[count - 1] = '\n';
+ }
+
(void) fwrite(linebuf, sizeof *linebuf, count, otf);
if (ferror(otf))
errx(1, "/tmp");
@@ -160,7 +170,7 @@ putline(obuf, linebuf)
/*
* Read up a line from the specified input into the line
* buffer. Return the number of characters read. Do not
- * include the newline at the end.
+ * include the newline (or carriage return) at the end.
*/
int
readline(ibuf, linebuf, linesize)
@@ -176,6 +186,8 @@ readline(ibuf, linebuf, linesize)
n = strlen(linebuf);
if (n > 0 && linebuf[n - 1] == '\n')
linebuf[--n] = '\0';
+ if (n > 0 && linebuf[n - 1] == '\r')
+ linebuf[--n] = '\0';
return n;
}