diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-09-04 20:44:05 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-09-04 20:44:05 +0000 |
commit | ea2f2007581e3a4e06e155848c4ff54d44b54860 (patch) | |
tree | 57e1311f7414a9d6399787634d5c968933b57b46 /usr.bin/mail | |
parent | 1de10a03d0fc2f83019fc527e7df9b85ad76c4c5 (diff) |
Deal with <CR><LF> pairs in mailboxes so we can work with eudora mail
spools mounted from DOS/Windoze. From Matt Thomas <matt@3am-software.com>.
Diffstat (limited to 'usr.bin/mail')
-rw-r--r-- | usr.bin/mail/fio.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.bin/mail/fio.c b/usr.bin/mail/fio.c index 7938749126b..7e372f82f8f 100644 --- a/usr.bin/mail/fio.c +++ b/usr.bin/mail/fio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fio.c,v 1.12 1997/08/31 14:32:13 millert Exp $ */ +/* $OpenBSD: fio.c,v 1.13 1997/09/04 20:44:04 millert Exp $ */ /* $NetBSD: fio.c,v 1.8 1997/07/07 22:57:55 phil Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95"; #else -static char rcsid[] = "$OpenBSD: fio.c,v 1.12 1997/08/31 14:32:13 millert Exp $"; +static char rcsid[] = "$OpenBSD: fio.c,v 1.13 1997/09/04 20:44:04 millert Exp $"; #endif #endif /* not lint */ @@ -109,6 +109,15 @@ setptr(ibuf, offset) return; } count = strlen(linebuf); + /* + * Transforms lines ending in <CR><LF> to just <LF>. + * This allows mail to be able to read Eudora mailboxes + * that reside on a DOS partition. + */ + if (count >= 2 && linebuf[count-1] == '\n' && + linebuf[count - 2] == '\r') + linebuf[count - 2] = linebuf[--count]; + (void)fwrite(linebuf, sizeof(*linebuf), count, otf); if (ferror(otf)) err(1, "/tmp"); @@ -178,7 +187,7 @@ putline(obuf, linebuf, outlf) /* * 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) @@ -195,6 +204,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); } |