CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Mon Apr 19 17:49:28 UTC 2021 Modified Files: src/usr.bin/mail: format.c Log Message: Fix weekday parsing; only reset the string when parsing fail and only set the weekday when parsing succeeds (Steffen Nurpmeso) To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mail/format.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/format.c diff -u src/usr.bin/mail/format.c:1.15 src/usr.bin/mail/format.c:1.16 --- src/usr.bin/mail/format.c:1.15 Sat Apr 11 10:22:32 2009 +++ src/usr.bin/mail/format.c Mon Apr 19 13:49:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: format.c,v 1.15 2009/04/11 14:22:32 christos Exp $ */ +/* $NetBSD: format.c,v 1.16 2021/04/19 17:49:28 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef __lint__ -__RCSID("$NetBSD: format.c,v 1.15 2009/04/11 14:22:32 christos Exp $"); +__RCSID("$NetBSD: format.c,v 1.16 2021/04/19 17:49:28 christos Exp $"); #endif /* not __lint__ */ #include @@ -579,10 +579,10 @@ date_to_tm(char *date, struct tm *tm) */ /* Check for an optional 'day-of-week' */ - if ((tail = strptime(date, " %a,", _tm)) == NULL) { + if ((tail = strptime(date, " %a,", _tm)) == NULL) tail = date; + else tm->tm_wday = tmp_tm.tm_wday; - } /* Get the required 'day' and 'month' */ if ((tail = strptime(tail, " %d %b", _tm)) == NULL)
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Wed Feb 17 21:09:39 UTC 2021 Modified Files: src/usr.bin/mail: dotlock.c Log Message: add O_CLOEXEC To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.bin/mail/dotlock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/dotlock.c diff -u src/usr.bin/mail/dotlock.c:1.13 src/usr.bin/mail/dotlock.c:1.14 --- src/usr.bin/mail/dotlock.c:1.13 Sat Jul 4 18:45:08 2015 +++ src/usr.bin/mail/dotlock.c Wed Feb 17 16:09:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dotlock.c,v 1.13 2015/07/04 22:45:08 christos Exp $ */ +/* $NetBSD: dotlock.c,v 1.14 2021/02/17 21:09:39 christos Exp $ */ /* * Copyright (c) 1996 Christos Zoulas. All rights reserved. @@ -26,7 +26,7 @@ #include #ifndef lint -__RCSID("$NetBSD: dotlock.c,v 1.13 2015/07/04 22:45:08 christos Exp $"); +__RCSID("$NetBSD: dotlock.c,v 1.14 2021/02/17 21:09:39 christos Exp $"); #endif #include "rcv.h" @@ -81,7 +81,8 @@ create_exclusive(const char *fname) * We try to create the unique filename. */ for (ntries = 0; ; ntries++) { - fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_SYNC, 0); + fd = open(path, + O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_SYNC|O_CLOEXEC, 0); if (fd != -1) { (void)close(fd); break;
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Tue Dec 17 19:12:50 UTC 2019 Modified Files: src/usr.bin/mail: Makefile Log Message: fix sun2 To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/usr.bin/mail/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/Makefile diff -u src/usr.bin/mail/Makefile:1.39 src/usr.bin/mail/Makefile:1.40 --- src/usr.bin/mail/Makefile:1.39 Sun Oct 13 03:28:15 2019 +++ src/usr.bin/mail/Makefile Tue Dec 17 14:12:50 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.39 2019/10/13 07:28:15 mrg Exp $ +# $NetBSD: Makefile,v 1.40 2019/12/17 19:12:50 christos Exp $ # @(#)Makefile 8.3 (Berkeley) 4/20/95 .include @@ -52,8 +52,8 @@ CPPFLAGS+= -DMIME_SUPPORT CPPFLAGS+= -DCHARSET_SUPPORT .endif -LDADD+= -lmagic -lz -DPADD+= ${LIBMAGIC} ${LIBZ} +LDADD+= -lmagic -llzma -lbz2 -lz +DPADD+= ${LIBMAGIC} ${LIBLZMA} ${LIBBZ2} ${LIBZ} .endif .endif
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Mon Dec 16 22:55:45 UTC 2019 Modified Files: src/usr.bin/mail: complete.c Log Message: revert previous, don't specialcase NUL string. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.bin/mail/complete.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/complete.c diff -u src/usr.bin/mail/complete.c:1.22 src/usr.bin/mail/complete.c:1.23 --- src/usr.bin/mail/complete.c:1.22 Sat Dec 14 23:17:38 2019 +++ src/usr.bin/mail/complete.c Mon Dec 16 17:55:45 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: complete.c,v 1.22 2019/12/15 04:17:38 christos Exp $ */ +/* $NetBSD: complete.c,v 1.23 2019/12/16 22:55:45 christos Exp $ */ /*- * Copyright (c) 1997-2000,2005,2006 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: complete.c,v 1.22 2019/12/15 04:17:38 christos Exp $"); +__RCSID("$NetBSD: complete.c,v 1.23 2019/12/16 22:55:45 christos Exp $"); #endif /* not lint */ /* @@ -339,8 +339,7 @@ complete_filename(EditLine *el, char *wo size_t len; if ((fname = strrchr(word, '/')) == NULL) { - if (word[0] == '+' && (mf = value(ENAME_FOLDER)) != NULL && *mf) - { + if (word[0] == '+' && (mf = value(ENAME_FOLDER)) != NULL) { if (mf[0] == '/') { (void)estrlcpy(dir, mf, sizeof(dir)); } else {
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sun Dec 15 04:17:38 UTC 2019 Modified Files: src/usr.bin/mail: complete.c Log Message: treat empty variables are unset (Steffen Nurpmeso) To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.bin/mail/complete.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/complete.c diff -u src/usr.bin/mail/complete.c:1.21 src/usr.bin/mail/complete.c:1.22 --- src/usr.bin/mail/complete.c:1.21 Sat Dec 14 15:28:02 2019 +++ src/usr.bin/mail/complete.c Sat Dec 14 23:17:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: complete.c,v 1.21 2019/12/14 20:28:02 christos Exp $ */ +/* $NetBSD: complete.c,v 1.22 2019/12/15 04:17:38 christos Exp $ */ /*- * Copyright (c) 1997-2000,2005,2006 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: complete.c,v 1.21 2019/12/14 20:28:02 christos Exp $"); +__RCSID("$NetBSD: complete.c,v 1.22 2019/12/15 04:17:38 christos Exp $"); #endif /* not lint */ /* @@ -339,7 +339,8 @@ complete_filename(EditLine *el, char *wo size_t len; if ((fname = strrchr(word, '/')) == NULL) { - if (word[0] == '+' && (mf = value(ENAME_FOLDER)) != NULL) { + if (word[0] == '+' && (mf = value(ENAME_FOLDER)) != NULL && *mf) + { if (mf[0] == '/') { (void)estrlcpy(dir, mf, sizeof(dir)); } else {
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sat Dec 14 20:28:03 UTC 2019 Modified Files: src/usr.bin/mail: complete.c Log Message: PR/54764: elo: Incorrect '+file' filename completion in mail(1) Add propel completion stem so that file completion works. pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.bin/mail/complete.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/complete.c diff -u src/usr.bin/mail/complete.c:1.20 src/usr.bin/mail/complete.c:1.21 --- src/usr.bin/mail/complete.c:1.20 Tue Jan 12 09:44:24 2010 +++ src/usr.bin/mail/complete.c Sat Dec 14 15:28:02 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: complete.c,v 1.20 2010/01/12 14:44:24 christos Exp $ */ +/* $NetBSD: complete.c,v 1.21 2019/12/14 20:28:02 christos Exp $ */ /*- * Copyright (c) 1997-2000,2005,2006 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: complete.c,v 1.20 2010/01/12 14:44:24 christos Exp $"); +__RCSID("$NetBSD: complete.c,v 1.21 2019/12/14 20:28:02 christos Exp $"); #endif /* not lint */ /* @@ -332,16 +332,27 @@ complete_filename(EditLine *el, char *wo { StringList *words; char dir[MAXPATHLEN]; - char *fname; + char *fname, *mf; DIR *dd; struct dirent *dp; unsigned char rv; size_t len; if ((fname = strrchr(word, '/')) == NULL) { - dir[0] = '.'; - dir[1] = '\0'; - fname = word; + if (word[0] == '+' && (mf = value(ENAME_FOLDER)) != NULL) { + if (mf[0] == '/') { +(void)estrlcpy(dir, mf, sizeof(dir)); + } else { +dir[0] = '~'; +dir[1] = '/'; +(void)estrlcpy(dir + 2, mf, sizeof(dir) - 2); + } + fname = word + 1; + } else { + dir[0] = '.'; + dir[1] = '\0'; + fname = word; + } } else { if (fname == word) { dir[0] = '/';
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sat Dec 14 20:23:38 UTC 2019 Modified Files: src/usr.bin/mail: mail.1 Log Message: PR/54765: elo: Minor error in the mail(1) man page (-F description truncated) pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/usr.bin/mail/mail.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mail.1 diff -u src/usr.bin/mail/mail.1:1.67 src/usr.bin/mail/mail.1:1.68 --- src/usr.bin/mail/mail.1:1.67 Sun Sep 1 15:10:39 2019 +++ src/usr.bin/mail/mail.1 Sat Dec 14 15:23:38 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: mail.1,v 1.67 2019/09/01 19:10:39 wiz Exp $ +.\" $NetBSD: mail.1,v 1.68 2019/12/14 20:23:38 christos Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)mail.1 8.8 (Berkeley) 4/28/95 .\" -.Dd September 1, 2019 +.Dd December 14, 2019 .Dt MAIL 1 .Os .Sh NAME @@ -1328,7 +1328,7 @@ Message headers currently being ignored or .Ic retain command) are not included. -.It Ic \&~ +.It Ic \&~F Ns Ar messages Identical to .Ic \&~f , except all message headers are included.
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sat Dec 14 20:21:43 UTC 2019 Modified Files: src/usr.bin/mail: mime_child.c Log Message: PR/54766: elo: Broken mime-hooks handling in mail(1) pullup-9. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/mail/mime_child.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mime_child.c diff -u src/usr.bin/mail/mime_child.c:1.9 src/usr.bin/mail/mime_child.c:1.10 --- src/usr.bin/mail/mime_child.c:1.9 Thu Nov 9 15:27:50 2017 +++ src/usr.bin/mail/mime_child.c Sat Dec 14 15:21:43 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_child.c,v 1.9 2017/11/09 20:27:50 christos Exp $ */ +/* $NetBSD: mime_child.c,v 1.10 2019/12/14 20:21:43 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include #ifndef __lint__ -__RCSID("$NetBSD: mime_child.c,v 1.9 2017/11/09 20:27:50 christos Exp $"); +__RCSID("$NetBSD: mime_child.c,v 1.10 2019/12/14 20:21:43 christos Exp $"); #endif /* not __lint__ */ #include @@ -159,7 +159,7 @@ mime_run_command(const char *cmd, FILE * default: /* parent */ (void)close(p[READ]); - nfo = fdopen(p[WRITE], "wef"); + nfo = fdopen(p[WRITE], "we"); if (nfo == NULL) { warn("mime_run_command: fdopen"); (void)close(p[WRITE]); @@ -203,7 +203,7 @@ mime_run_function(void (*fn)(FILE *, FIL default: /* parent */ (void)close(p[READ]); - nfo = fdopen(p[WRITE], "wef"); + nfo = fdopen(p[WRITE], "we"); if (nfo == NULL) { warn("run_function: fdopen"); (void)close(p[WRITE]);
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Wed May 23 01:03:46 UTC 2018 Modified Files: src/usr.bin/mail: Makefile mail.1 Log Message: Remove Mail To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.bin/mail/Makefile cvs rdiff -u -r1.63 -r1.64 src/usr.bin/mail/mail.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/Makefile diff -u src/usr.bin/mail/Makefile:1.36 src/usr.bin/mail/Makefile:1.37 --- src/usr.bin/mail/Makefile:1.36 Sat Jul 5 15:22:04 2014 +++ src/usr.bin/mail/Makefile Tue May 22 21:03:46 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.36 2014/07/05 19:22:04 dholland Exp $ +# $NetBSD: Makefile,v 1.37 2018/05/23 01:03:46 christos Exp $ # @(#)Makefile 8.3 (Berkeley) 4/20/95 .include @@ -26,8 +26,8 @@ SRCS= version.c support.c cmd1.c cmd2.c dotlock.c edit.c fio.c format.c getname.c head.c v7.local.c lex.c \ list.c main.c names.c popen.c quit.c send.c sig.c strings.c temp.c \ tty.c vars.c -LINKS= ${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx -MLINKS= mail.1 Mail.1 mail.1 mailx.1 +LINKS= ${BINDIR}/mail ${BINDIR}/mailx +MLINKS= mail.1 mailx.1 LDADD+= -lutil DPADD+= ${LIBUTIL} Index: src/usr.bin/mail/mail.1 diff -u src/usr.bin/mail/mail.1:1.63 src/usr.bin/mail/mail.1:1.64 --- src/usr.bin/mail/mail.1:1.63 Mon Jul 3 17:34:20 2017 +++ src/usr.bin/mail/mail.1 Tue May 22 21:03:46 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: mail.1,v 1.63 2017/07/03 21:34:20 wiz Exp $ +.\" $NetBSD: mail.1,v 1.64 2018/05/23 01:03:46 christos Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,13 +29,12 @@ .\" .\" @(#)mail.1 8.8 (Berkeley) 4/28/95 .\" -.Dd December 15, 2014 +.Dd May 22, 2018 .Dt MAIL 1 .Os .Sh NAME .Nm mail , -.Nm mailx , -.Nm Mail +.Nm mailx .Nd send and receive mail .Sh SYNOPSIS .Nm @@ -2299,11 +2298,14 @@ originally written by Kurt Shoens. There are some flags and commands that are not documented here. Most are not useful to the general user. .Pp -Usually, +Historically, .Nm -is just a link to +was just a link to .Nm Mail , -which can be confusing. +which was confusing. +.Nm Mail +has been removed in +.Nx 9 . .Pp The name of the .Ic alternates
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Thu Nov 9 20:27:50 UTC 2017 Modified Files: src/usr.bin/mail: cmd2.c cmd3.c collect.c edit.c fio.c lex.c list.c mime_attach.c mime_child.c mime_detach.c names.c quit.c send.c support.c Log Message: Only open regular files. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.bin/mail/cmd2.c cvs rdiff -u -r1.43 -r1.44 src/usr.bin/mail/cmd3.c src/usr.bin/mail/lex.c cvs rdiff -u -r1.48 -r1.49 src/usr.bin/mail/collect.c cvs rdiff -u -r1.28 -r1.29 src/usr.bin/mail/edit.c src/usr.bin/mail/quit.c cvs rdiff -u -r1.42 -r1.43 src/usr.bin/mail/fio.c cvs rdiff -u -r1.27 -r1.28 src/usr.bin/mail/list.c cvs rdiff -u -r1.18 -r1.19 src/usr.bin/mail/mime_attach.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/mail/mime_child.c \ src/usr.bin/mail/mime_detach.c cvs rdiff -u -r1.32 -r1.33 src/usr.bin/mail/names.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/mail/send.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/mail/support.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/cmd2.c diff -u src/usr.bin/mail/cmd2.c:1.25 src/usr.bin/mail/cmd2.c:1.26 --- src/usr.bin/mail/cmd2.c:1.25 Sun Apr 29 19:50:22 2012 +++ src/usr.bin/mail/cmd2.c Thu Nov 9 15:27:50 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: cmd2.c,v 1.25 2012/04/29 23:50:22 christos Exp $ */ +/* $NetBSD: cmd2.c,v 1.26 2017/11/09 20:27:50 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: cmd2.c,v 1.25 2012/04/29 23:50:22 christos Exp $"); +__RCSID("$NetBSD: cmd2.c,v 1.26 2017/11/09 20:27:50 christos Exp $"); #endif #endif /* not lint */ @@ -230,7 +230,7 @@ save1(char str[], int markmsg, const cha disp = "[Appended]"; else disp = "[New file]"; - if ((obuf = Fopen(fn, "ae")) == NULL) { + if ((obuf = Fopen(fn, "aef")) == NULL) { warn(NULL); return 1; } Index: src/usr.bin/mail/cmd3.c diff -u src/usr.bin/mail/cmd3.c:1.43 src/usr.bin/mail/cmd3.c:1.44 --- src/usr.bin/mail/cmd3.c:1.43 Tue Dec 16 14:30:24 2014 +++ src/usr.bin/mail/cmd3.c Thu Nov 9 15:27:50 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: cmd3.c,v 1.43 2014/12/16 19:30:24 christos Exp $ */ +/* $NetBSD: cmd3.c,v 1.44 2017/11/09 20:27:50 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95"; #else -__RCSID("$NetBSD: cmd3.c,v 1.43 2014/12/16 19:30:24 christos Exp $"); +__RCSID("$NetBSD: cmd3.c,v 1.44 2017/11/09 20:27:50 christos Exp $"); #endif #endif /* not lint */ @@ -501,7 +501,7 @@ bounce_one(int msgno, const char **smarg (void)snprintf(mailtempname, sizeof(mailtempname), "%s/mail.RsXX", tmpdir); if ((fd = mkstemp(mailtempname)) == -1 || - (obuf = Fdopen(fd, "we+")) == NULL) { + (obuf = Fdopen(fd, "wef+")) == NULL) { if (fd != -1) (void)close(fd); warn("%s", mailtempname); Index: src/usr.bin/mail/lex.c diff -u src/usr.bin/mail/lex.c:1.43 src/usr.bin/mail/lex.c:1.44 --- src/usr.bin/mail/lex.c:1.43 Wed Feb 20 09:38:13 2013 +++ src/usr.bin/mail/lex.c Thu Nov 9 15:27:50 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.43 2013/02/20 14:38:13 christos Exp $ */ +/* $NetBSD: lex.c,v 1.44 2017/11/09 20:27:50 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)lex.c 8.2 (Berkeley) 4/20/95"; #else -__RCSID("$NetBSD: lex.c,v 1.43 2013/02/20 14:38:13 christos Exp $"); +__RCSID("$NetBSD: lex.c,v 1.44 2017/11/09 20:27:50 christos Exp $"); #endif #endif /* not lint */ @@ -214,7 +214,7 @@ setfile(const char *name) if ((name = expand(name)) == NULL) return -1; - if ((ibuf = Fopen(name, "re")) == NULL) { + if ((ibuf = Fopen(name, "ref")) == NULL) { if (!isedit && errno == ENOENT) goto nomail; warn("Can't open `%s'", name); @@ -278,9 +278,9 @@ setfile(const char *name) (void)snprintf(tempname, sizeof(tempname), "%s/mail.RxXX", tmpdir); if ((fd = mkstemp(tempname)) == -1 || - (otf = fdopen(fd, "we")) == NULL) + (otf = fdopen(fd, "wef")) == NULL) err(EXIT_FAILURE, "Can't create tmp file `%s'", tempname); - if ((itf = fopen(tempname, "re")) == NULL) + if ((itf = fopen(tempname, "ref")) == NULL) err(EXIT_FAILURE, "Can't create tmp file `%s'", tempname); (void)rm(tempname); setptr(ibuf, (off_t)0); @@ -317,7 +317,7 @@ incfile(void) omsgCount = get_abs_msgCount(); - ibuf = Fopen(mailname, "re"); + ibuf = Fopen(mailname, "ref"); if (ibuf == NULL) return -1; sig_check(); @@ -1121,7 +1121,7 @@ load(const char *name) { FILE *in, *oldin; - if ((in = Fopen(name, "re")) == NULL) + if ((in = Fopen(name, "ref")) == NULL) return; oldin = input; input = in; Index: src/usr.bin/mail/collect.c diff -u src/usr.bin/mail/collect.c:1.48 src/usr.bin/mail/collect.c:1.49 ---
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Tue May 2 03:29:14 UTC 2017 Modified Files: src/usr.bin/mail: collect.c Log Message: reset signal handler before returning. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/usr.bin/mail/collect.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/collect.c diff -u src/usr.bin/mail/collect.c:1.47 src/usr.bin/mail/collect.c:1.48 --- src/usr.bin/mail/collect.c:1.47 Fri Jun 28 13:36:18 2013 +++ src/usr.bin/mail/collect.c Mon May 1 23:29:14 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: collect.c,v 1.47 2013/06/28 17:36:18 christos Exp $ */ +/* $NetBSD: collect.c,v 1.48 2017/05/02 03:29:14 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)collect.c 8.2 (Berkeley) 4/19/94"; #else -__RCSID("$NetBSD: collect.c,v 1.47 2013/06/28 17:36:18 christos Exp $"); +__RCSID("$NetBSD: collect.c,v 1.48 2017/05/02 03:29:14 christos Exp $"); #endif #endif /* not lint */ @@ -314,9 +314,11 @@ coll_int(int signo) (void)puts("@"); (void)fflush(stdout); clearerr(stdin); + signal(SIGINT, o); return; } hadintr = 1; + signal(SIGINT, o); longjmp(reset_jmpbuf, signo); } if (collf) {
CVS commit: src/usr.bin/mail
Module Name:src Committed By: abhinav Date: Mon Jan 23 10:05:25 UTC 2017 Modified Files: src/usr.bin/mail: mail.1 Log Message: Fix spelling: s/overritten/overwritten To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/usr.bin/mail/mail.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mail.1 diff -u src/usr.bin/mail/mail.1:1.61 src/usr.bin/mail/mail.1:1.62 --- src/usr.bin/mail/mail.1:1.61 Tue Dec 16 19:30:24 2014 +++ src/usr.bin/mail/mail.1 Mon Jan 23 10:05:25 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: mail.1,v 1.61 2014/12/16 19:30:24 christos Exp $ +.\" $NetBSD: mail.1,v 1.62 2017/01/23 10:05:25 abhinav Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -2260,7 +2260,7 @@ This can be overwritten by setting the environment variable. .It ~/mbox User's old mail. -This can be overritten by setting the +This can be overwritten by setting the .Ev MBOX environment variable. .It ~/.mailrc
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Wed Feb 3 05:18:58 UTC 2016 Modified Files: src/usr.bin/mail: edit.c Log Message: PR/50746: David Binderman: Check bounds before dereferencing. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/mail/edit.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/edit.c diff -u src/usr.bin/mail/edit.c:1.27 src/usr.bin/mail/edit.c:1.28 --- src/usr.bin/mail/edit.c:1.27 Sun Apr 29 19:50:22 2012 +++ src/usr.bin/mail/edit.c Wed Feb 3 00:18:58 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: edit.c,v 1.27 2012/04/29 23:50:22 christos Exp $ */ +/* $NetBSD: edit.c,v 1.28 2016/02/03 05:18:58 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)edit.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: edit.c,v 1.27 2012/04/29 23:50:22 christos Exp $"); +__RCSID("$NetBSD: edit.c,v 1.28 2016/02/03 05:18:58 christos Exp $"); #endif #endif /* not lint */ @@ -163,7 +163,7 @@ edit1(int *msgvec, int editortype) * Deal with each message to be edited . . . */ msgCount = get_msgCount(); - for (i = 0; msgvec[i] && i < msgCount; i++) { + for (i = 0; i < msgCount && msgvec[i]; i++) { sigset_t oset; struct sigaction osa;
CVS commit: src/usr.bin/mail/USD.doc
Module Name:src Committed By: christos Date: Wed Nov 25 01:12:03 UTC 2015 Modified Files: src/usr.bin/mail/USD.doc: Makefile mail0.nr Log Message: PR/50360: Thomas Klausner: Fix MKREPRO issue To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/mail/USD.doc/Makefile cvs rdiff -u -r1.3 -r1.4 src/usr.bin/mail/USD.doc/mail0.nr Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/USD.doc/Makefile diff -u src/usr.bin/mail/USD.doc/Makefile:1.7 src/usr.bin/mail/USD.doc/Makefile:1.8 --- src/usr.bin/mail/USD.doc/Makefile:1.7 Sat Jul 5 15:22:43 2014 +++ src/usr.bin/mail/USD.doc/Makefile Tue Nov 24 20:12:03 2015 @@ -1,11 +1,16 @@ -# $NetBSD: Makefile,v 1.7 2014/07/05 19:22:43 dholland Exp $ +# $NetBSD: Makefile,v 1.8 2015/11/25 01:12:03 christos Exp $ # from: @(#)Makefile 8.1 (Berkeley) 6/8/93 +.include + SECTION=reference/ref1 ARTICLE=mail SRCS= mail0.nr mail1.nr mail2.nr mail3.nr mail4.nr mail5.nr mail6.nr \ mail7.nr mail8.nr mail9.nr maila.nr MACROS= -me +.if ${MKREPRO:Uno} == "yes" +MACROS+= -rR=1 +.endif ROFF_TBL=yes #EXTRAHTMLFILES=# none! Index: src/usr.bin/mail/USD.doc/mail0.nr diff -u src/usr.bin/mail/USD.doc/mail0.nr:1.3 src/usr.bin/mail/USD.doc/mail0.nr:1.4 --- src/usr.bin/mail/USD.doc/mail0.nr:1.3 Thu Aug 7 07:14:43 2003 +++ src/usr.bin/mail/USD.doc/mail0.nr Tue Nov 24 20:12:03 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: mail0.nr,v 1.3 2003/08/07 11:14:43 agc Exp $ +.\" $NetBSD: mail0.nr,v 1.4 2015/11/25 01:12:03 christos Exp $ .\" .\" Copyright (c) 1980, 1993 .\" The Regents of the University of California. All rights reserved. @@ -63,7 +63,9 @@ Mark Andrews .(l C Version 5.5 - +.if \nR==0 \ +\{ \*(td .)l +.\} .pn 2
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sat Jul 4 15:09:49 UTC 2015 Modified Files: src/usr.bin/mail: dotlock.c Log Message: If we fail 5 times in a row, fail correctly (Steffen Nurpmeso). To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.bin/mail/dotlock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/dotlock.c diff -u src/usr.bin/mail/dotlock.c:1.11 src/usr.bin/mail/dotlock.c:1.12 --- src/usr.bin/mail/dotlock.c:1.11 Tue Oct 20 21:07:46 2009 +++ src/usr.bin/mail/dotlock.c Sat Jul 4 11:09:49 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: dotlock.c,v 1.11 2009/10/21 01:07:46 snj Exp $ */ +/* $NetBSD: dotlock.c,v 1.12 2015/07/04 15:09:49 christos Exp $ */ /* * Copyright (c) 1996 Christos Zoulas. All rights reserved. @@ -26,7 +26,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: dotlock.c,v 1.11 2009/10/21 01:07:46 snj Exp $); +__RCSID($NetBSD: dotlock.c,v 1.12 2015/07/04 15:09:49 christos Exp $); #endif #include rcv.h @@ -80,13 +80,13 @@ create_exclusive(const char *fname) /* * We try to create the unique filename. */ - for (ntries = 0; ntries 5; ntries++) { + for (ntries = 0; ; ntries++) { fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_SYNC, 0); if (fd != -1) { (void)close(fd); break; } - else if (errno == EEXIST) + else if (errno == EEXIST || ntries 5) continue; else return -1;
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sat Jul 4 22:45:08 UTC 2015 Modified Files: src/usr.bin/mail: dotlock.c Log Message: fix infinite loop To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.bin/mail/dotlock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/dotlock.c diff -u src/usr.bin/mail/dotlock.c:1.12 src/usr.bin/mail/dotlock.c:1.13 --- src/usr.bin/mail/dotlock.c:1.12 Sat Jul 4 11:09:49 2015 +++ src/usr.bin/mail/dotlock.c Sat Jul 4 18:45:08 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: dotlock.c,v 1.12 2015/07/04 15:09:49 christos Exp $ */ +/* $NetBSD: dotlock.c,v 1.13 2015/07/04 22:45:08 christos Exp $ */ /* * Copyright (c) 1996 Christos Zoulas. All rights reserved. @@ -26,7 +26,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: dotlock.c,v 1.12 2015/07/04 15:09:49 christos Exp $); +__RCSID($NetBSD: dotlock.c,v 1.13 2015/07/04 22:45:08 christos Exp $); #endif #include rcv.h @@ -86,7 +86,7 @@ create_exclusive(const char *fname) (void)close(fd); break; } - else if (errno == EEXIST || ntries 5) + else if (errno == EEXIST ntries 5) continue; else return -1;
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Wed Jun 17 00:03:42 UTC 2015 Modified Files: src/usr.bin/mail: mime_attach.c Log Message: one more stray \n To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mail/mime_attach.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mime_attach.c diff -u src/usr.bin/mail/mime_attach.c:1.17 src/usr.bin/mail/mime_attach.c:1.18 --- src/usr.bin/mail/mime_attach.c:1.17 Fri Oct 18 16:47:06 2013 +++ src/usr.bin/mail/mime_attach.c Tue Jun 16 20:03:42 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_attach.c,v 1.17 2013/10/18 20:47:06 christos Exp $ */ +/* $NetBSD: mime_attach.c,v 1.18 2015/06/17 00:03:42 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: mime_attach.c,v 1.17 2013/10/18 20:47:06 christos Exp $); +__RCSID($NetBSD: mime_attach.c,v 1.18 2015/06/17 00:03:42 christos Exp $); #endif /* not __lint__ */ #include assert.h @@ -529,7 +529,7 @@ fput_body(FILE *fi, FILE *fo, struct Con enc = mime_fio_encoder(Cp-C_encoding); if (enc == NULL) - warnx(unknown transfer encoding type: %s\n, Cp-C_encoding); + warnx(unknown transfer encoding type: %s, Cp-C_encoding); else enc(fi, fo, 0); }
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sat Jan 10 17:16:01 UTC 2015 Modified Files: src/usr.bin/mail: fio.c names.c Log Message: fix incorrect arg size computation To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/usr.bin/mail/fio.c cvs rdiff -u -r1.31 -r1.32 src/usr.bin/mail/names.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/fio.c diff -u src/usr.bin/mail/fio.c:1.41 src/usr.bin/mail/fio.c:1.42 --- src/usr.bin/mail/fio.c:1.41 Tue Dec 16 14:30:24 2014 +++ src/usr.bin/mail/fio.c Sat Jan 10 12:16:01 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: fio.c,v 1.41 2014/12/16 19:30:24 christos Exp $ */ +/* $NetBSD: fio.c,v 1.42 2015/01/10 17:16:01 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)fio.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: fio.c,v 1.41 2014/12/16 19:30:24 christos Exp $); +__RCSID($NetBSD: fio.c,v 1.42 2015/01/10 17:16:01 christos Exp $); #endif #endif /* not lint */ @@ -475,6 +475,7 @@ expand(const char *name) switch (e) { case 0: /* OK */ + break; case WRDE_NOSPACE: warnx(Out of memory expanding `%s', name); return NULL; @@ -497,9 +498,9 @@ expand(const char *name) warnx(No match for `%s', name); break; case 1: - if (strlen(we.we_wordv[1]) = PATHSIZE) + if (strlen(we.we_wordv[0]) = PATHSIZE) warnx(Expansion too long for `%s', name); - strlcpy(xname, we.we_wordv[1], PATHSIZE); + strlcpy(xname, we.we_wordv[0], PATHSIZE); break; default: warnx(Ambiguous expansion for `%s', name); Index: src/usr.bin/mail/names.c diff -u src/usr.bin/mail/names.c:1.31 src/usr.bin/mail/names.c:1.32 --- src/usr.bin/mail/names.c:1.31 Tue Dec 16 14:30:24 2014 +++ src/usr.bin/mail/names.c Sat Jan 10 12:16:01 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: names.c,v 1.31 2014/12/16 19:30:24 christos Exp $ */ +/* $NetBSD: names.c,v 1.32 2015/01/10 17:16:01 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)names.c 8.1 (Berkeley) 6/6/93; #else -__RCSID($NetBSD: names.c,v 1.31 2014/12/16 19:30:24 christos Exp $); +__RCSID($NetBSD: names.c,v 1.32 2015/01/10 17:16:01 christos Exp $); #endif #endif /* not lint */ @@ -550,7 +550,7 @@ unpack(struct name *smopts, struct name * the terminating 0 pointer. Additional spots may be needed * to pass along -f to the host mailer. */ - extra = 3 * count(smopts); + extra = 3 + count(smopts); extra++; metoo = value(ENAME_METOO) != NULL; if (metoo)
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Tue Dec 16 19:30:24 UTC 2014 Modified Files: src/usr.bin/mail: cmd3.c extern.h fio.c mail.1 names.c send.c Log Message: Fix various security related issues: 0001. Do not recognize paths, mail folders, and pipes in mail addresses by default. That avoids a direct command injection with syntactically valid email addresses starting with |. Such addresses can be specified both on the command line, the mail headers (with -t) or in address lines copied over from previous while replying. This was assigned CVE-2014-7844 for some versions of BSD mailx. It is documented behavior for Heirloom mailx, and was mentioned in an old technical report about BSD mailx (which does not usually make its way into operating system installations). The patch switches off this processing and updates the documentation. Added expandaddr option to explicitly enable this behavior. 0002. When invoking sendmail, prevent option processing for email address arguments. This prevents changing e.g. the Postfix configuration file in unexpected ways. This behavior was documented for BSD mailx (sort of), but not for Heirloom mailx. We did not assign a CVE to this because it is more of a missing feature, and code invoking mailx needs adjustment in the caller as well. Fixed. 0003. Make wordexp support mandatory. (No functional change.) Fixed (replaced explicit shell pipe implementation). 0004. Prevent command execution in the expand function, which is IMHO unexpected. (Not really required with patch 1, and there is still information disclosure/DoS potential if this expansion occurs.) This is a historic vulnerability already fixed in the Debian package, retroactively assigned CVE-2004-2771: Fixed (as part of the pipe replacement with wordexp). To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.bin/mail/cmd3.c cvs rdiff -u -r1.32 -r1.33 src/usr.bin/mail/extern.h cvs rdiff -u -r1.40 -r1.41 src/usr.bin/mail/fio.c cvs rdiff -u -r1.60 -r1.61 src/usr.bin/mail/mail.1 cvs rdiff -u -r1.30 -r1.31 src/usr.bin/mail/names.c cvs rdiff -u -r1.37 -r1.38 src/usr.bin/mail/send.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/cmd3.c diff -u src/usr.bin/mail/cmd3.c:1.42 src/usr.bin/mail/cmd3.c:1.43 --- src/usr.bin/mail/cmd3.c:1.42 Sun Apr 29 19:50:22 2012 +++ src/usr.bin/mail/cmd3.c Tue Dec 16 14:30:24 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: cmd3.c,v 1.42 2012/04/29 23:50:22 christos Exp $ */ +/* $NetBSD: cmd3.c,v 1.43 2014/12/16 19:30:24 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)cmd3.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: cmd3.c,v 1.42 2012/04/29 23:50:22 christos Exp $); +__RCSID($NetBSD: cmd3.c,v 1.43 2014/12/16 19:30:24 christos Exp $); #endif #endif /* not lint */ @@ -577,7 +577,7 @@ bounce(void *v) if (hdr.h_to == NULL) return 1; - smargs = unpack(hdr.h_to); + smargs = unpack(NULL, hdr.h_to); for (ip = msgvec; *ip; ip++) { int e; if ((e = bounce_one(*ip, smargs, hdr.h_to)) != 0) Index: src/usr.bin/mail/extern.h diff -u src/usr.bin/mail/extern.h:1.32 src/usr.bin/mail/extern.h:1.33 --- src/usr.bin/mail/extern.h:1.32 Tue Feb 28 17:30:44 2012 +++ src/usr.bin/mail/extern.h Tue Dec 16 14:30:24 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.32 2012/02/28 22:30:44 joerg Exp $ */ +/* $NetBSD: extern.h,v 1.33 2014/12/16 19:30:24 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * @(#)extern.h 8.2 (Berkeley) 4/20/95 - * $NetBSD: extern.h,v 1.32 2012/02/28 22:30:44 joerg Exp $ + * $NetBSD: extern.h,v 1.33 2014/12/16 19:30:24 christos Exp $ */ #ifndef __EXTERN_H__ @@ -224,7 +224,7 @@ struct name * extract(char [], int); struct name * gexpand(struct name *, struct grouphead *, int, int); struct name * nalloc(char [], int); struct name * outof(struct name *, FILE *, struct header *); -const char ** unpack(struct name *); +const char ** unpack(struct name *, struct name *); struct name * usermap(struct name *); #if 0 void prettyprint(struct name *); /* commented out? */ Index: src/usr.bin/mail/fio.c diff -u src/usr.bin/mail/fio.c:1.40 src/usr.bin/mail/fio.c:1.41 --- src/usr.bin/mail/fio.c:1.40 Sat Mar 9 14:43:07 2013 +++ src/usr.bin/mail/fio.c Tue Dec 16 14:30:24 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: fio.c,v 1.40 2013/03/09 19:43:07 christos Exp $ */ +/* $NetBSD: fio.c,v 1.41 2014/12/16 19:30:24 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)fio.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: fio.c,v 1.40 2013/03/09 19:43:07 christos Exp $); +__RCSID($NetBSD: fio.c,v 1.41 2014/12/16 19:30:24 christos Exp $); #endif #endif /* not lint */ @@ -42,6 +42,7 @@
CVS commit: src/usr.bin/mail/USD.doc
Module Name:src Committed By: christos Date: Wed Oct 1 23:41:41 UTC 2014 Modified Files: src/usr.bin/mail/USD.doc: mail5.nr mail9.nr Log Message: put back ua will fix differently. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.bin/mail/USD.doc/mail5.nr cvs rdiff -u -r1.5 -r1.6 src/usr.bin/mail/USD.doc/mail9.nr Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/USD.doc/mail5.nr diff -u src/usr.bin/mail/USD.doc/mail5.nr:1.6 src/usr.bin/mail/USD.doc/mail5.nr:1.7 --- src/usr.bin/mail/USD.doc/mail5.nr:1.6 Tue Sep 30 16:54:11 2014 +++ src/usr.bin/mail/USD.doc/mail5.nr Wed Oct 1 19:41:41 2014 @@ -1,4 +1,4 @@ -.\ $NetBSD: mail5.nr,v 1.6 2014/09/30 20:54:11 christos Exp $ +.\ $NetBSD: mail5.nr,v 1.7 2014/10/01 23:41:41 christos Exp $ .\ .\ Copyright (c) 1980, 1993 .\ The Regents of the University of California. All rights reserved. @@ -58,7 +58,7 @@ consists of a list of message numbers, r separated by spaces or tabs. Message numbers may be either decimal numbers, which directly specify messages, or one of the special characters -.q \(ha +.q \(ua .q . or .q $ Index: src/usr.bin/mail/USD.doc/mail9.nr diff -u src/usr.bin/mail/USD.doc/mail9.nr:1.5 src/usr.bin/mail/USD.doc/mail9.nr:1.6 --- src/usr.bin/mail/USD.doc/mail9.nr:1.5 Tue Sep 30 16:54:11 2014 +++ src/usr.bin/mail/USD.doc/mail9.nr Wed Oct 1 19:41:41 2014 @@ -1,4 +1,4 @@ -.\ $NetBSD: mail9.nr,v 1.5 2014/09/30 20:54:11 christos Exp $ +.\ $NetBSD: mail9.nr,v 1.6 2014/10/01 23:41:41 christos Exp $ .\ .\ Copyright (c) 1980, 1993 .\ The Regents of the University of California. All rights reserved. @@ -121,7 +121,7 @@ escape valued Escape character to be use folder valued Directory to store folders in hold binary Hold messages in system mailbox by default ignore binary Ignore \s-2RUBOUT\s0 while sending mail -ignoreeof binary Don't terminate letters/command input with \fB\(haD\fP +ignoreeof binary Don't terminate letters/command input with \fB\(uaD\fP keep binary Don't unlink system mailbox when empty keepsave binary Don't delete \fBsave\fPd messages by default metoo binary Include sending user in aliases
CVS commit: src/usr.bin/mail/USD.doc
Module Name:src Committed By: christos Date: Tue Sep 30 20:54:11 UTC 2014 Modified Files: src/usr.bin/mail/USD.doc: mail5.nr mail9.nr Log Message: There is no \(ua in roff, you really mean \(ha (Circumflex-Accent) aka ^ To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/mail/USD.doc/mail5.nr cvs rdiff -u -r1.4 -r1.5 src/usr.bin/mail/USD.doc/mail9.nr Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/USD.doc/mail5.nr diff -u src/usr.bin/mail/USD.doc/mail5.nr:1.5 src/usr.bin/mail/USD.doc/mail5.nr:1.6 --- src/usr.bin/mail/USD.doc/mail5.nr:1.5 Thu Aug 7 07:14:45 2003 +++ src/usr.bin/mail/USD.doc/mail5.nr Tue Sep 30 16:54:11 2014 @@ -1,4 +1,4 @@ -.\ $NetBSD: mail5.nr,v 1.5 2003/08/07 11:14:45 agc Exp $ +.\ $NetBSD: mail5.nr,v 1.6 2014/09/30 20:54:11 christos Exp $ .\ .\ Copyright (c) 1980, 1993 .\ The Regents of the University of California. All rights reserved. @@ -58,7 +58,7 @@ consists of a list of message numbers, r separated by spaces or tabs. Message numbers may be either decimal numbers, which directly specify messages, or one of the special characters -.q \(ua +.q \(ha .q . or .q $ Index: src/usr.bin/mail/USD.doc/mail9.nr diff -u src/usr.bin/mail/USD.doc/mail9.nr:1.4 src/usr.bin/mail/USD.doc/mail9.nr:1.5 --- src/usr.bin/mail/USD.doc/mail9.nr:1.4 Thu Aug 7 07:14:46 2003 +++ src/usr.bin/mail/USD.doc/mail9.nr Tue Sep 30 16:54:11 2014 @@ -1,4 +1,4 @@ -.\ $NetBSD: mail9.nr,v 1.4 2003/08/07 11:14:46 agc Exp $ +.\ $NetBSD: mail9.nr,v 1.5 2014/09/30 20:54:11 christos Exp $ .\ .\ Copyright (c) 1980, 1993 .\ The Regents of the University of California. All rights reserved. @@ -121,7 +121,7 @@ escape valued Escape character to be use folder valued Directory to store folders in hold binary Hold messages in system mailbox by default ignore binary Ignore \s-2RUBOUT\s0 while sending mail -ignoreeof binary Don't terminate letters/command input with \fB\(uaD\fP +ignoreeof binary Don't terminate letters/command input with \fB\(haD\fP keep binary Don't unlink system mailbox when empty keepsave binary Don't delete \fBsave\fPd messages by default metoo binary Include sending user in aliases
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Fri Oct 18 20:17:59 UTC 2013 Modified Files: src/usr.bin/mail: cmd1.c Log Message: avoid longjmp clobber. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.bin/mail/cmd1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/cmd1.c diff -u src/usr.bin/mail/cmd1.c:1.33 src/usr.bin/mail/cmd1.c:1.34 --- src/usr.bin/mail/cmd1.c:1.33 Tue Jun 12 15:03:26 2012 +++ src/usr.bin/mail/cmd1.c Fri Oct 18 16:17:59 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: cmd1.c,v 1.33 2012/06/12 19:03:26 christos Exp $ */ +/* $NetBSD: cmd1.c,v 1.34 2013/10/18 20:17:59 christos Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)cmd1.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: cmd1.c,v 1.33 2012/06/12 19:03:26 christos Exp $); +__RCSID($NetBSD: cmd1.c,v 1.34 2013/10/18 20:17:59 christos Exp $); #endif #endif /* not lint */ @@ -325,6 +325,7 @@ type1(int *msgvec, int doign, int mime_d * not what it is pointing at! */ FILE *volatile obuf; /* avoid longjmp clobbering */ + int * volatile mvec; sig_t volatile oldsigpipe; /* avoid longjmp clobbering? */ #ifdef MIME_SUPPORT struct mime_info *volatile mip; /* avoid longjmp clobbering? */ @@ -332,6 +333,7 @@ type1(int *msgvec, int doign, int mime_d mip = NULL; #endif + mvec = msgvec; if ((obuf = last_registered_file(0)) == NULL) obuf = stdout; @@ -348,7 +350,7 @@ type1(int *msgvec, int doign, int mime_d msgCount = get_msgCount(); recursive = do_recursion(); - for (ip = msgvec; *ip ip - msgvec msgCount; ip++) { + for (ip = mvec; *ip ip - mvec msgCount; ip++) { struct type1_core_args_s args; struct message *mp;
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Fri Jun 28 17:36:18 UTC 2013 Modified Files: src/usr.bin/mail: collect.c Log Message: prevent re-entry race and crash To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/usr.bin/mail/collect.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/collect.c diff -u src/usr.bin/mail/collect.c:1.46 src/usr.bin/mail/collect.c:1.47 --- src/usr.bin/mail/collect.c:1.46 Tue Jun 12 15:03:26 2012 +++ src/usr.bin/mail/collect.c Fri Jun 28 13:36:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: collect.c,v 1.46 2012/06/12 19:03:26 christos Exp $ */ +/* $NetBSD: collect.c,v 1.47 2013/06/28 17:36:18 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)collect.c 8.2 (Berkeley) 4/19/94; #else -__RCSID($NetBSD: collect.c,v 1.46 2012/06/12 19:03:26 christos Exp $); +__RCSID($NetBSD: collect.c,v 1.47 2013/06/28 17:36:18 christos Exp $); #endif #endif /* not lint */ @@ -304,6 +304,7 @@ savedeadletter(FILE *fp) static void coll_int(int signo) { + sig_t o = signal(SIGINT, SIG_IGN); /* * the control flow is subtle, because we can be called from ~q. @@ -318,9 +319,12 @@ coll_int(int signo) hadintr = 1; longjmp(reset_jmpbuf, signo); } - rewind(collf); - if (value(ENAME_NOSAVE) == NULL) - savedeadletter(collf); + if (collf) { + rewind(collf); + if (value(ENAME_NOSAVE) == NULL) + savedeadletter(collf); + } + signal(SIGINT, o); longjmp(abort_jmpbuf, signo); }
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sat Mar 9 19:43:07 UTC 2013 Modified Files: src/usr.bin/mail: fio.c Log Message: undo previous; mail never expanded $ variables in folder. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/usr.bin/mail/fio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/fio.c diff -u src/usr.bin/mail/fio.c:1.39 src/usr.bin/mail/fio.c:1.40 --- src/usr.bin/mail/fio.c:1.39 Wed Mar 6 15:49:20 2013 +++ src/usr.bin/mail/fio.c Sat Mar 9 14:43:07 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: fio.c,v 1.39 2013/03/06 20:49:20 christos Exp $ */ +/* $NetBSD: fio.c,v 1.40 2013/03/09 19:43:07 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)fio.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: fio.c,v 1.39 2013/03/06 20:49:20 christos Exp $); +__RCSID($NetBSD: fio.c,v 1.40 2013/03/09 19:43:07 christos Exp $); #endif #endif /* not lint */ @@ -394,21 +394,18 @@ getfold(char *name, size_t namesize) { char unres[PATHSIZE], res[PATHSIZE]; char *folder; - const char *f; if ((folder = value(ENAME_FOLDER)) == NULL) return -1; - if ((f = expand(folder)) == NULL) - return -1; - if (*f != '/') { - (void)snprintf(unres, sizeof(unres), %s/%s, homedir, f); - f = unres; + if (*folder != '/') { + (void)snprintf(unres, sizeof(unres), %s/%s, homedir, folder); + folder = unres; } - if (realpath(f, res) == NULL) - warn(Can't canonicalize folder `%s', f); + if (realpath(folder, res) == NULL) + warn(Can't canonicalize folder `%s', folder); else - f = res; - (void)strlcpy(name, f, namesize); + folder = res; + (void)strlcpy(name, folder, namesize); return 0; }
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sat Mar 9 19:43:21 UTC 2013 Modified Files: src/usr.bin/mail: mail.1 Log Message: Document more environment settings. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/usr.bin/mail/mail.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mail.1 diff -u src/usr.bin/mail/mail.1:1.59 src/usr.bin/mail/mail.1:1.60 --- src/usr.bin/mail/mail.1:1.59 Thu Dec 23 15:11:00 2010 +++ src/usr.bin/mail/mail.1 Sat Mar 9 14:43:20 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: mail.1,v 1.59 2010/12/23 20:11:00 njoly Exp $ +.\ $NetBSD: mail.1,v 1.60 2013/03/09 19:43:20 christos Exp $ .\ .\ Copyright (c) 1980, 1990, 1993 .\ The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\ .\ @(#)mail.1 8.8 (Berkeley) 4/28/95 .\ -.Dd February 18, 2009 +.Dd March 9, 2013 .Dt MAIL 1 .Os .Sh NAME @@ -2251,8 +2251,14 @@ environment variables. .Bl -tag -width /usr/share/misc/mail.*help -compact .It Pa /var/mail/* Post office. +This can be overwritten by setting the +.Ev MAIL +environment variable. .It ~/mbox User's old mail. +This can be overritten by setting the +.Ev MBOX +environment variable. .It ~/.mailrc File giving initial mail commands. This can be overridden by setting the
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Wed Mar 6 20:49:20 UTC 2013 Modified Files: src/usr.bin/mail: fio.c Log Message: since we are calling realpath() earlier now, we need to expand the name of the folder in case it contained variables like $HOME. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.bin/mail/fio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/fio.c diff -u src/usr.bin/mail/fio.c:1.38 src/usr.bin/mail/fio.c:1.39 --- src/usr.bin/mail/fio.c:1.38 Wed Feb 20 09:38:13 2013 +++ src/usr.bin/mail/fio.c Wed Mar 6 15:49:20 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: fio.c,v 1.38 2013/02/20 14:38:13 christos Exp $ */ +/* $NetBSD: fio.c,v 1.39 2013/03/06 20:49:20 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)fio.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: fio.c,v 1.38 2013/02/20 14:38:13 christos Exp $); +__RCSID($NetBSD: fio.c,v 1.39 2013/03/06 20:49:20 christos Exp $); #endif #endif /* not lint */ @@ -394,18 +394,21 @@ getfold(char *name, size_t namesize) { char unres[PATHSIZE], res[PATHSIZE]; char *folder; + const char *f; if ((folder = value(ENAME_FOLDER)) == NULL) return -1; - if (*folder != '/') { - (void)snprintf(unres, sizeof(unres), %s/%s, homedir, folder); - folder = unres; + if ((f = expand(folder)) == NULL) + return -1; + if (*f != '/') { + (void)snprintf(unres, sizeof(unres), %s/%s, homedir, f); + f = unres; } - if (realpath(folder, res) == NULL) - warn(Can't canonicalize folder `%s', folder); + if (realpath(f, res) == NULL) + warn(Can't canonicalize folder `%s', f); else - folder = res; - (void)strlcpy(name, folder, namesize); + f = res; + (void)strlcpy(name, f, namesize); return 0; }
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Wed Feb 20 14:38:13 UTC 2013 Modified Files: src/usr.bin/mail: fio.c lex.c Log Message: PR/47577: Steffen Daode Nurpmeso: Refinement to previous to keep always keep track of the folder when it is updated. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/mail/fio.c cvs rdiff -u -r1.42 -r1.43 src/usr.bin/mail/lex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/fio.c diff -u src/usr.bin/mail/fio.c:1.37 src/usr.bin/mail/fio.c:1.38 --- src/usr.bin/mail/fio.c:1.37 Tue Feb 19 12:43:32 2013 +++ src/usr.bin/mail/fio.c Wed Feb 20 09:38:13 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: fio.c,v 1.37 2013/02/19 17:43:32 christos Exp $ */ +/* $NetBSD: fio.c,v 1.38 2013/02/20 14:38:13 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)fio.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: fio.c,v 1.37 2013/02/19 17:43:32 christos Exp $); +__RCSID($NetBSD: fio.c,v 1.38 2013/02/20 14:38:13 christos Exp $); #endif #endif /* not lint */ @@ -397,15 +397,15 @@ getfold(char *name, size_t namesize) if ((folder = value(ENAME_FOLDER)) == NULL) return -1; - if (*folder == '/') - (void)strlcpy(unres, folder, sizeof(unres)); - else + if (*folder != '/') { (void)snprintf(unres, sizeof(unres), %s/%s, homedir, folder); - if (realpath(unres, res) == NULL) { - warn(Can't canonicalize folder `%s', unres); - (void)strlcpy(name, unres, namesize); - } else - (void)strlcpy(name, res, namesize); + folder = unres; + } + if (realpath(folder, res) == NULL) + warn(Can't canonicalize folder `%s', folder); + else + folder = res; + (void)strlcpy(name, folder, namesize); return 0; } Index: src/usr.bin/mail/lex.c diff -u src/usr.bin/mail/lex.c:1.42 src/usr.bin/mail/lex.c:1.43 --- src/usr.bin/mail/lex.c:1.42 Tue Feb 19 12:43:32 2013 +++ src/usr.bin/mail/lex.c Wed Feb 20 09:38:13 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.42 2013/02/19 17:43:32 christos Exp $ */ +/* $NetBSD: lex.c,v 1.43 2013/02/20 14:38:13 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)lex.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: lex.c,v 1.42 2013/02/19 17:43:32 christos Exp $); +__RCSID($NetBSD: lex.c,v 1.43 2013/02/20 14:38:13 christos Exp $); #endif #endif /* not lint */ @@ -147,7 +147,8 @@ update_mailname(const char *name) char tbuf[PATHSIZE]; size_t l; - if (realpath(name, mailname) == NULL) { + /* Don't realpath(3) if it's only an update request */ + if (name != NULL realpath(name, mailname) == NULL) { warn(Can't canonicalize `%s', name); return; } @@ -272,8 +273,7 @@ setfile(const char *name) shudclob = 1; edit = isedit; (void)strcpy(prevfile, mailname); - if (name != mailname) - update_mailname(name); + update_mailname(name != mailname ? name : NULL); mailsize = fsize(ibuf); (void)snprintf(tempname, sizeof(tempname), %s/mail.RxXX, tmpdir); @@ -1057,6 +1057,7 @@ newfileinfo(int omsgCount) /* * Display the statistics. */ + update_mailname(NULL); (void)printf(\%s\: , displayname); { int cnt = get_abs_msgCount();
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Tue Feb 19 17:43:33 UTC 2013 Modified Files: src/usr.bin/mail: fio.c glob.h lex.c Log Message: PR/47577: Steffen Daode Nurpmeso: Keep a resolved folder name together with a display name in order to keep track of current state when the directory is changed. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.bin/mail/fio.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/mail/glob.h cvs rdiff -u -r1.41 -r1.42 src/usr.bin/mail/lex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/fio.c diff -u src/usr.bin/mail/fio.c:1.36 src/usr.bin/mail/fio.c:1.37 --- src/usr.bin/mail/fio.c:1.36 Sat Oct 20 21:10:22 2012 +++ src/usr.bin/mail/fio.c Tue Feb 19 12:43:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: fio.c,v 1.36 2012/10/21 01:10:22 christos Exp $ */ +/* $NetBSD: fio.c,v 1.37 2013/02/19 17:43:32 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)fio.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: fio.c,v 1.36 2012/10/21 01:10:22 christos Exp $); +__RCSID($NetBSD: fio.c,v 1.37 2013/02/19 17:43:32 christos Exp $); #endif #endif /* not lint */ @@ -392,14 +392,20 @@ fsize(FILE *iob) PUBLIC int getfold(char *name, size_t namesize) { + char unres[PATHSIZE], res[PATHSIZE]; char *folder; if ((folder = value(ENAME_FOLDER)) == NULL) return -1; if (*folder == '/') - (void)strlcpy(name, folder, namesize); + (void)strlcpy(unres, folder, sizeof(unres)); else - (void)snprintf(name, namesize, %s/%s, homedir, folder); + (void)snprintf(unres, sizeof(unres), %s/%s, homedir, folder); + if (realpath(unres, res) == NULL) { + warn(Can't canonicalize folder `%s', unres); + (void)strlcpy(name, unres, namesize); + } else + (void)strlcpy(name, res, namesize); return 0; } Index: src/usr.bin/mail/glob.h diff -u src/usr.bin/mail/glob.h:1.12 src/usr.bin/mail/glob.h:1.13 --- src/usr.bin/mail/glob.h:1.12 Fri Apr 10 09:08:25 2009 +++ src/usr.bin/mail/glob.h Tue Feb 19 12:43:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: glob.h,v 1.12 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: glob.h,v 1.13 2013/02/19 17:43:32 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * from: @(#)glob.h 8.1 (Berkeley) 6/6/93 - * $NetBSD: glob.h,v 1.12 2009/04/10 13:08:25 christos Exp $ + * $NetBSD: glob.h,v 1.13 2013/02/19 17:43:32 christos Exp $ */ /* @@ -59,6 +59,7 @@ EXTERN FILE *otf;/* Output temp file EXTERN int image;/* File descriptor for image of msg */ EXTERN FILE *input;/* Current command input file */ EXTERN char mailname[PATHSIZE]; /* Name of current file */ +EXTERN char displayname[80]; /* Prettyfied for display */ EXTERN char prevfile[PATHSIZE]; /* Name of previous file */ EXTERN char *tmpdir; /* Path name of temp directory */ EXTERN char *homedir; /* Path name of home directory */ Index: src/usr.bin/mail/lex.c diff -u src/usr.bin/mail/lex.c:1.41 src/usr.bin/mail/lex.c:1.42 --- src/usr.bin/mail/lex.c:1.41 Sun Apr 29 19:50:22 2012 +++ src/usr.bin/mail/lex.c Tue Feb 19 12:43:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.41 2012/04/29 23:50:22 christos Exp $ */ +/* $NetBSD: lex.c,v 1.42 2013/02/19 17:43:32 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)lex.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: lex.c,v 1.41 2012/04/29 23:50:22 christos Exp $); +__RCSID($NetBSD: lex.c,v 1.42 2013/02/19 17:43:32 christos Exp $); #endif #endif /* not lint */ @@ -141,6 +141,46 @@ file_leak_check(void) } #endif /* DEBUG_FILE_LEAK */ +static void +update_mailname(const char *name) +{ + char tbuf[PATHSIZE]; + size_t l; + + if (realpath(name, mailname) == NULL) { + warn(Can't canonicalize `%s', name); + return; + } + + if (getfold(tbuf, sizeof(tbuf)) = 0) { + l = strlen(tbuf); + if (l sizeof(tbuf) - 1) + tbuf[l++] = '/'; + if (strncmp(tbuf, mailname, l) == 0) { + char const *sep = , *cp = mailname + l; + + l = strlen(cp); + if (l = sizeof(displayname)) { +cp += l; +cp -= sizeof(displayname) - 5; +sep = ...; + } + (void)snprintf(displayname, sizeof(displayname), + +%s%s, sep, cp); + return; + } + } + + l = strlen(mailname); + if (l sizeof(displayname)) + strcpy(displayname, mailname); + else { + l -= sizeof(displayname) - 4 - sizeof(displayname) / 3; + (void)snprintf(displayname, sizeof(displayname), %.*s...%s, + (int)sizeof(displayname) / 3, mailname, mailname + l); + } +} + /* * Set the size of the message vector used to construct argument * lists to message list functions. @@ -233,7 +273,7 @@ setfile(const char *name) edit = isedit; (void)strcpy(prevfile, mailname); if (name != mailname) - (void)strcpy(mailname, name); + update_mailname(name); mailsize = fsize(ibuf); (void)snprintf(tempname, sizeof(tempname),
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Thu Feb 14 18:23:46 UTC 2013 Modified Files: src/usr.bin/mail: mime_codecs.c mime_codecs.h mime_header.c Log Message: PR/47657: Steffen Daode Nurpmeso: quoted printable CTE exceeds RFC limit. - Encapsulated all the content-transfer-encoding stuff in mime_codecs.c - Replaced calls of strtol(3) with a handcrafted version that allows simple error checking by testing the return value. This allows to easily add special code to handle illegal QP sequences. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/mail/mime_codecs.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/mail/mime_codecs.h cvs rdiff -u -r1.8 -r1.9 src/usr.bin/mail/mime_header.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mime_codecs.c diff -u src/usr.bin/mail/mime_codecs.c:1.10 src/usr.bin/mail/mime_codecs.c:1.11 --- src/usr.bin/mail/mime_codecs.c:1.10 Sat Nov 24 16:40:02 2012 +++ src/usr.bin/mail/mime_codecs.c Thu Feb 14 13:23:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_codecs.c,v 1.10 2012/11/24 21:40:02 christos Exp $ */ +/* $NetBSD: mime_codecs.c,v 1.11 2013/02/14 18:23:45 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -52,7 +52,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: mime_codecs.c,v 1.10 2012/11/24 21:40:02 christos Exp $); +__RCSID($NetBSD: mime_codecs.c,v 1.11 2013/02/14 18:23:45 christos Exp $); #endif /* not __lint__ */ #include assert.h @@ -389,10 +389,84 @@ mime_fB64_decode(FILE *fi, FILE *fo, voi / * Core quoted-printable routines. * - * Note: the header QP routines are slightly different and burried - * inside mime_header.c + * Defined in sec 6.7 of RFC 2045. */ +/* + * strtol(3), but inline and with easy error indication. + */ +static inline int +_qp_cfromhex(char const *hex) +{ + /* Be robust, allow lowercase hexadecimal letters, too */ + static unsigned char const atoi16[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x30-0x37 */ + 0x08, 0x09, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x38-0x3F */ + 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0xFF, /* 0x40-0x47 */ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x48-0x4f */ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x50-0x57 */ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x58-0x5f */ + 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0xFF /* 0x60-0x67 */ + }; + unsigned char i1, i2; + int r; + + if ((i1 = (unsigned char)hex[0] - '0') = __arraycount(atoi16) || + (i2 = (unsigned char)hex[1] - '0') = __arraycount(atoi16)) + goto jerr; + i1 = atoi16[i1]; + i2 = atoi16[i2]; + if ((i1 | i2) 0xF0) + goto jerr; + r = i1; + r = 4; + r += i2; +jleave: + return r; +jerr: + r = -1; + goto jleave; +} + +/* + * Header specific quoted-printable decode! + * Differences with body QP decoding (see rfc 2047, sec 4.2): + * 1) '=' occurs _only_ when followed by two hex digits (FWS is not allowed). + * 2) Spaces can be encoded as '_' in headers for readability. + */ +static ssize_t +mime_QPh_decode(char *outbuf, size_t outlen, const char *inbuf, size_t inlen) +{ + const char *p, *inend; + char *outend; + char *q; + + outend = outbuf + outlen; + inend = inbuf + inlen; + q = outbuf; + for (p = inbuf; p inend; p++) { + if (q = outend) + return -1; + if (*p == '=') { + p++; + if (p + 1 inend) { +int c = _qp_cfromhex(p++); +if (c 0) + return -1; +*q++ = (char)c; + } + else +return -1; + } + else if (*p == '_') /* header's may encode ' ' as '_' */ + *q++ = ' '; + else + *q++ = *p; + } + return q - outbuf; +} + + static int mustquote(unsigned char *p, unsigned char *end, size_t l) { @@ -479,8 +553,11 @@ fput_quoted_line(FILE *fo, char *line, s } else { if (*p == '\n') { -if (p beg p[-1] == '\r') +if (p beg p[-1] == '\r') { + if (l + 4 limit) + (void)fputs(=\n, fo); (void)fputs(=0A=, fo); +} l = (size_t)-1; } else if (l + 2 limit) { @@ -541,14 +618,11 @@ mime_fQP_decode(FILE *fi, FILE *fo, void while (p end is_WSP(*p)) p++; if (*p != '\n' p + 1 end) { - int c; - char buf[3]; - - buf[0] = *p++; - buf[1] = *p; - buf[2] = '\0'; - c = (int)strtol(buf, NULL, 16); - (void)fputc(c, fo); + int c = _qp_cfromhex(p++); + if (c = 0) + (void)fputc(c, fo); + else + (void)fputs([?], fo); } } else @@ -631,6 +705,24 @@ mime_fio_decoder(const char *ename) } /* + * Decode a RFC 2047 extended message header *encoded-word*. + * *encoding* is the corresponding character of the *encoded-word*. + */ +PUBLIC ssize_t +mime_rfc2047_decode(char encoding, char *outbuf, size_t outlen, + const char *inbuf, size_t inlen) +{ + ssize_t declen = -1; + + if (encoding == 'B' || encoding
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Wed Jan 16 15:21:42 UTC 2013 Modified Files: src/usr.bin/mail: head.c Log Message: From: Steffen Daode Nurpmeso: Amend the previous commit to support zone-style RFC 822 dates. RFC 5322 marks this zone-style as obsolete (obs-zone), but still supports it. But then, even if you don't wanna support military style single-letter zones, the UT zone exists and will not be supported by this commit. The changes here are not strictly correct (since not all possible single-letter zones are assigned, and only *UT* has two letters), but which will match all thre possible *obs-zone* forms. Compiled and tested on a single MBOX. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/mail/head.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/head.c diff -u src/usr.bin/mail/head.c:1.23 src/usr.bin/mail/head.c:1.24 --- src/usr.bin/mail/head.c:1.23 Tue Jan 15 12:25:42 2013 +++ src/usr.bin/mail/head.c Wed Jan 16 10:21:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: head.c,v 1.23 2013/01/15 17:25:42 christos Exp $ */ +/* $NetBSD: head.c,v 1.24 2013/01/16 15:21:42 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)head.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: head.c,v 1.23 2013/01/15 17:25:42 christos Exp $); +__RCSID($NetBSD: head.c,v 1.24 2013/01/16 15:21:42 christos Exp $); #endif #endif /* not lint */ @@ -115,22 +115,52 @@ cmatch(const char *cp, const char *tp) * 'N' A new line * '+' A plus or minus sign */ -static const char *datetypes[] = { - Aaa Aaa O0 00:00:00 , /* BSD ctype */ - Aaa Aaa O0 00:00 , /* SysV ctype */ - Aaa Aaa O0 00:00:00 AAA , /* BSD tmztype */ - Aaa Aaa O0 00:00 AAA , /* SysV tmztype */ - Aaa Aaa O0 00:00:00 +, /* RFC822 type */ - Aaa Aaa O0 00:00:00 AAA, /* RFC822 alttype */ +static struct cmatch_data { + size_t tlen; + char const *tdata; +} const cmatch_data[] = { +#define TSZ(a) (sizeof(a) - 1), a + { TSZ(Aaa Aaa O0 00:00:00 ) }, /* BSD ctype */ + { TSZ(Aaa Aaa O0 00:00 ) }, /* SysV ctype */ + { TSZ(Aaa Aaa O0 00:00:00 AAA ) }, /* BSD tmztype */ + { TSZ(Aaa Aaa O0 00:00 AAA ) }, /* SysV tmztype */ + /* + * RFC 822-alike From_ lines do not conform to RFC 4155, but seem to + * be used in the wild by UW-imap (MBX format plus) + */ + { TSZ(Aaa Aaa O0 00:00:00 +) }, /* RFC822, UT offset */ + /* + * RFC 822 with zone spec: + *1. military, + *2. UT, + *3. north america time zone strings + * note that 1. is strictly speaking not correct as some letters are + * not used + */ + { TSZ(Aaa Aaa O0 00:00:00 A) }, + { TSZ(Aaa Aaa O0 00:00:00 AA) }, +{ TSZ(Aaa Aaa O0 00:00:00 AAA) }, + { 0, NULL }, }; static int isdate(const char date[]) { + static size_t cmatch_minlen = 0; + struct cmatch_data const *cmdp; + size_t dl = strlen(date); + + if (cmatch_minlen == 0) + for (cmdp = cmatch_data; cmdp-tdata != NULL; ++cmdp) + cmatch_minlen = MIN(cmatch_minlen, cmdp-tlen); - for (size_t i = 0; i __arraycount(datetypes); i++) - if (cmatch(date, datetypes[i])) + if (dl cmatch_minlen) + return 0; + + for (cmdp = cmatch_data; cmdp-tdata != NULL; ++cmdp) + if (dl == cmdp-tlen cmatch(date, cmdp-tdata)) return 1; + return 0; }
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Tue Jan 15 17:25:42 UTC 2013 Modified Files: src/usr.bin/mail: head.c Log Message: PR/47453: Martin Branderburg: Mail (mail, mailx) does not recognize messages which have RFC 822 format dates. XXX: Pullup 6 To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.bin/mail/head.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/head.c diff -u src/usr.bin/mail/head.c:1.22 src/usr.bin/mail/head.c:1.23 --- src/usr.bin/mail/head.c:1.22 Sat Dec 1 06:41:50 2012 +++ src/usr.bin/mail/head.c Tue Jan 15 12:25:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: head.c,v 1.22 2012/12/01 11:41:50 mbalmer Exp $ */ +/* $NetBSD: head.c,v 1.23 2013/01/15 17:25:42 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)head.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: head.c,v 1.22 2012/12/01 11:41:50 mbalmer Exp $); +__RCSID($NetBSD: head.c,v 1.23 2013/01/15 17:25:42 christos Exp $); #endif #endif /* not lint */ @@ -52,7 +52,7 @@ __RCSID($NetBSD: head.c,v 1.22 2012/12/ * Return 1 if they match, 0 if they don't */ static int -cmatch(const char *cp, char *tp) +cmatch(const char *cp, const char *tp) { while (*cp *tp) @@ -86,6 +86,11 @@ cmatch(const char *cp, char *tp) if (*cp++ != '\n') return 0; break; + case '+': + if (*cp != '+' *cp != '-') +return 0; + cp++; + break; } if (*cp || *tp) return 0; @@ -108,19 +113,25 @@ cmatch(const char *cp, char *tp) * 'O' An optional digit or space * ':' A colon * 'N' A new line + * '+' A plus or minus sign */ -static char ctype[] = Aaa Aaa O0 00:00:00 ; -static char SysV_ctype[] = Aaa Aaa O0 00:00 ; -static char tmztype[] = Aaa Aaa O0 00:00:00 AAA ; -static char SysV_tmztype[] = Aaa Aaa O0 00:00 AAA ; +static const char *datetypes[] = { + Aaa Aaa O0 00:00:00 , /* BSD ctype */ + Aaa Aaa O0 00:00 , /* SysV ctype */ + Aaa Aaa O0 00:00:00 AAA , /* BSD tmztype */ + Aaa Aaa O0 00:00 AAA , /* SysV tmztype */ + Aaa Aaa O0 00:00:00 +, /* RFC822 type */ + Aaa Aaa O0 00:00:00 AAA, /* RFC822 alttype */ +}; static int isdate(const char date[]) { - return cmatch(date, ctype) || - cmatch(date, tmztype) || - cmatch(date, SysV_tmztype) || cmatch(date, SysV_ctype); + for (size_t i = 0; i __arraycount(datetypes); i++) + if (cmatch(date, datetypes[i])) + return 1; + return 0; } static void
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Fri Jan 4 01:43:59 UTC 2013 Modified Files: src/usr.bin/mail: mime_attach.c Log Message: PR/47395: Steffen: mail(1) unnecessarily uses base64 if a CR without a LF is seen To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/usr.bin/mail/mime_attach.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mime_attach.c diff -u src/usr.bin/mail/mime_attach.c:1.14 src/usr.bin/mail/mime_attach.c:1.15 --- src/usr.bin/mail/mime_attach.c:1.14 Sun Apr 29 19:50:22 2012 +++ src/usr.bin/mail/mime_attach.c Thu Jan 3 20:43:59 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_attach.c,v 1.14 2012/04/29 23:50:22 christos Exp $ */ +/* $NetBSD: mime_attach.c,v 1.15 2013/01/04 01:43:59 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: mime_attach.c,v 1.14 2012/04/29 23:50:22 christos Exp $); +__RCSID($NetBSD: mime_attach.c,v 1.15 2013/01/04 01:43:59 christos Exp $); #endif /* not __lint__ */ #include assert.h @@ -236,7 +236,7 @@ content_encoding_core(void *fh, const ch while ((c = fgetc(fh)) != EOF) { curlen++; - if (c == '\0' || (lastc == '\r' c != '\n')) + if (c == '\0') return MIME_TRANSFER_BASE64; if (c 0x7f) { @@ -252,7 +252,7 @@ content_encoding_core(void *fh, const ch maxlen = curlen; curlen = 0; } - else if ((c 0x20 c != '\t') || c == 0x7f) + else if ((c 0x20 c != '\t') || c == 0x7f || lastc == '\r') ctrlchar = 1; lastc = c;
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Fri Jan 4 01:54:55 UTC 2013 Modified Files: src/usr.bin/mail: mime_attach.c Log Message: PR/47396: Steffen: mail(1) may falsely use quoted-printable for files with embedded NULs --- mime_attach.c.orig 2013-01-03 19:26:26.0 +0100 +++ mime_attach.c 2013-01-03 19:42:09.0 +0100 @@ -224,43 +224,42 @@ is_text(const char *ctype) static const char * content_encoding_core(void *fh, const char *ctype) { + enum { + _CLEAN = 0, + _ENDWS = 10, + _CTRLC = 11, + _8BIT = 12, + _LONGL = 13 + } state = _CLEAN; + size_t maxlen = line_limit(), curlen; int c, lastc; - int ctrlchar, endwhite; - size_t curlen, maxlen; - curlen = 0; - maxlen = 0; - ctrlchar = 0; - endwhite = 0; - lastc = EOF; - while ((c = fgetc(fh)) != EOF) { + for (curlen = 0, lastc = EOF; (c = fgetc(fh)) != EOF; lastc = c) { curlen++; - if (c == '\0' || (lastc == '\r' c != '\n')) + if (c == '\0') return MIME_TRANSFER_BASE64; if (c 0x7f) { - if (is_text(ctype)) - return MIME_TRANSFER_QUOTED; - else + if (! is_text(ctype)) return MIME_TRANSFER_BASE64; + state |= _8BIT; + continue; } if (c == '\n') { if (is_WSP(lastc)) - endwhite = 1; + state |= _ENDWS; if (curlen maxlen) - maxlen = curlen; + state |= _LONGL; curlen = 0; } - else if ((c 0x20 c != '\t') || c == 0x7f) - ctrlchar = 1; - - lastc = c; + else if ((c 0x20 c != '\t') || c == 0x7f || lastc == '\r') + state |= _CTRLC; } if (lastc == EOF) /* no characters read */ return MIME_TRANSFER_7BIT; - if (lastc != '\n' || ctrlchar || endwhite || maxlen line_limit()) + if (lastc != '\n' || state != _CLEAN) return MIME_TRANSFER_QUOTED; return MIME_TRANSFER_7BIT; To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mail/mime_attach.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mime_attach.c diff -u src/usr.bin/mail/mime_attach.c:1.15 src/usr.bin/mail/mime_attach.c:1.16 --- src/usr.bin/mail/mime_attach.c:1.15 Thu Jan 3 20:43:59 2013 +++ src/usr.bin/mail/mime_attach.c Thu Jan 3 20:54:55 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_attach.c,v 1.15 2013/01/04 01:43:59 christos Exp $ */ +/* $NetBSD: mime_attach.c,v 1.16 2013/01/04 01:54:55 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: mime_attach.c,v 1.15 2013/01/04 01:43:59 christos Exp $); +__RCSID($NetBSD: mime_attach.c,v 1.16 2013/01/04 01:54:55 christos Exp $); #endif /* not __lint__ */ #include assert.h @@ -224,12 +224,18 @@ is_text(const char *ctype) static const char * content_encoding_core(void *fh, const char *ctype) { - int c, lastc; +#define MAILMSG_CLEAN 0x0 +#define MAILMSG_ENDWS 0x1 +#define MAILMSG_CTRLC 0x2 +#define MAILMSG_8BIT 0x4 +#define MAILMSG_LONGL 0x8 + int c, lastc, state; int ctrlchar, endwhite; size_t curlen, maxlen; + state = MAILMSG_CLEAN; curlen = 0; - maxlen = 0; + maxlen = line_limit(); ctrlchar = 0; endwhite = 0; lastc = EOF; @@ -240,27 +246,26 @@ content_encoding_core(void *fh, const ch return MIME_TRANSFER_BASE64; if (c 0x7f) { - if (is_text(ctype)) -return MIME_TRANSFER_QUOTED; - else + if (!is_text(ctype)) return MIME_TRANSFER_BASE64; + state |= MAILMSG_8BIT; + continue; } if (c == '\n') { if (is_WSP(lastc)) -endwhite = 1; +state |= MAILMSG_ENDWS; if (curlen maxlen) -maxlen = curlen; +state |= MAILMSG_LONGL; curlen = 0; } else if ((c 0x20 c != '\t') || c == 0x7f || lastc == '\r') - ctrlchar = 1; - + state |= MAILMSG_CTRLC; lastc = c; } if (lastc == EOF) /* no characters read */ return MIME_TRANSFER_7BIT; - if (lastc != '\n' || ctrlchar || endwhite || maxlen line_limit()) + if (lastc != '\n' || state != MAILMSG_CLEAN) return MIME_TRANSFER_QUOTED; return MIME_TRANSFER_7BIT;
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sat Nov 24 21:40:02 UTC 2012 Modified Files: src/usr.bin/mail: mime_codecs.c Log Message: PR/47237: Steffen Nurpmeso: Detect more than 2 pad characters and mark as bad. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/mail/mime_codecs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mime_codecs.c diff -u src/usr.bin/mail/mime_codecs.c:1.9 src/usr.bin/mail/mime_codecs.c:1.10 --- src/usr.bin/mail/mime_codecs.c:1.9 Fri Apr 10 09:08:25 2009 +++ src/usr.bin/mail/mime_codecs.c Sat Nov 24 16:40:02 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_codecs.c,v 1.9 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: mime_codecs.c,v 1.10 2012/11/24 21:40:02 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -52,7 +52,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: mime_codecs.c,v 1.9 2009/04/10 13:08:25 christos Exp $); +__RCSID($NetBSD: mime_codecs.c,v 1.10 2012/11/24 21:40:02 christos Exp $); #endif /* not __lint__ */ #include assert.h @@ -237,6 +237,10 @@ mime_b64tobin(char *bin, const char *b64 unsigned c = uchar64(q[2]); unsigned d = uchar64(q[3]); + if (a == BAD || a == EQU || b == BAD || b == EQU || + c == BAD || d == BAD) + return -1; + *p++ = ((a 2) | ((b 0x30) 4)); if (c == EQU) { /* got '=' */ if (d != EQU) @@ -248,9 +252,6 @@ mime_b64tobin(char *bin, const char *b64 break; } *p++ = (((c 0x03) 6) | d); - - if (a == BAD || b == BAD || c == BAD || d == BAD) - return -1; } #undef uchar64
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sun Oct 21 22:18:16 UTC 2012 Modified Files: src/usr.bin/mail: thread.c Log Message: don't check for i and use j. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/mail/thread.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/thread.c diff -u src/usr.bin/mail/thread.c:1.9 src/usr.bin/mail/thread.c:1.10 --- src/usr.bin/mail/thread.c:1.9 Sat Apr 11 10:22:32 2009 +++ src/usr.bin/mail/thread.c Sun Oct 21 18:18:16 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: thread.c,v 1.9 2009/04/11 14:22:32 christos Exp $ */ +/* $NetBSD: thread.c,v 1.10 2012/10/21 22:18:16 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: thread.c,v 1.9 2009/04/11 14:22:32 christos Exp $); +__RCSID($NetBSD: thread.c,v 1.10 2012/10/21 22:18:16 christos Exp $); #endif /* not __lint__ */ #include assert.h @@ -1002,7 +1002,7 @@ thread_on_reference(struct message *mp) */ for (j = 0; j mcount; j++) { /* message_id will be NULL on mbox files */ - if (marray[i].message_id == NULL) + if (marray[j].message_id == NULL) continue; if (equal(marray[j].message_id, parent_id)) {
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sun Oct 21 01:10:22 UTC 2012 Modified Files: src/usr.bin/mail: fio.c Log Message: consistently use warn To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.bin/mail/fio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/fio.c diff -u src/usr.bin/mail/fio.c:1.35 src/usr.bin/mail/fio.c:1.36 --- src/usr.bin/mail/fio.c:1.35 Sun Apr 29 19:50:22 2012 +++ src/usr.bin/mail/fio.c Sat Oct 20 21:10:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: fio.c,v 1.35 2012/04/29 23:50:22 christos Exp $ */ +/* $NetBSD: fio.c,v 1.36 2012/10/21 01:10:22 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)fio.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: fio.c,v 1.35 2012/04/29 23:50:22 christos Exp $); +__RCSID($NetBSD: fio.c,v 1.36 2012/10/21 01:10:22 christos Exp $); #endif #endif /* not lint */ @@ -440,7 +440,7 @@ expand(const char *name) if (name[1] != 0) break; if (prevfile[0] == 0) { - (void)printf(No previous file\n); + warnx(No previous file); return NULL; } return savestr(prevfile);
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sun Oct 21 01:11:23 UTC 2012 Modified Files: src/usr.bin/mail: names.c Log Message: PR/47098: Steffen Daode Nurpmeso: mail(1): SEGV with bad globbed file argument To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/mail/names.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/names.c diff -u src/usr.bin/mail/names.c:1.29 src/usr.bin/mail/names.c:1.30 --- src/usr.bin/mail/names.c:1.29 Sun Apr 29 19:50:22 2012 +++ src/usr.bin/mail/names.c Sat Oct 20 21:11:23 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: names.c,v 1.29 2012/04/29 23:50:22 christos Exp $ */ +/* $NetBSD: names.c,v 1.30 2012/10/21 01:11:23 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)names.c 8.1 (Berkeley) 6/6/93; #else -__RCSID($NetBSD: names.c,v 1.29 2012/04/29 23:50:22 christos Exp $); +__RCSID($NetBSD: names.c,v 1.30 2012/10/21 01:11:23 christos Exp $); #endif #endif /* not lint */ @@ -266,8 +266,16 @@ outof(struct name *names, FILE *fo, stru ispipe = np-n_name[0] == '|'; if (ispipe) fname = np-n_name+1; - else + else { fname = expand(np-n_name); + if (fname == NULL) { +warnx(Filename expansion of %s failed, +np-n_name); +senderr++; +goto cant; + } + } + /* * See if we have copied the complete message out yet.
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Tue Jun 12 19:03:26 UTC 2012 Modified Files: src/usr.bin/mail: cmd1.c collect.c sig.c sig.h Log Message: make sure that signal handlers are always initialized. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/mail/cmd1.c cvs rdiff -u -r1.45 -r1.46 src/usr.bin/mail/collect.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/mail/sig.c cvs rdiff -u -r1.1 -r1.2 src/usr.bin/mail/sig.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/cmd1.c diff -u src/usr.bin/mail/cmd1.c:1.32 src/usr.bin/mail/cmd1.c:1.33 --- src/usr.bin/mail/cmd1.c:1.32 Sun Apr 29 19:50:22 2012 +++ src/usr.bin/mail/cmd1.c Tue Jun 12 15:03:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cmd1.c,v 1.32 2012/04/29 23:50:22 christos Exp $ */ +/* $NetBSD: cmd1.c,v 1.33 2012/06/12 19:03:26 christos Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)cmd1.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: cmd1.c,v 1.32 2012/04/29 23:50:22 christos Exp $); +__RCSID($NetBSD: cmd1.c,v 1.33 2012/06/12 19:03:26 christos Exp $); #endif #endif /* not lint */ @@ -448,7 +448,7 @@ pipecmd(void *v) { char *cmd; FILE *volatile obuf; /* void longjmp clobbering */ - sig_t volatile oldsigpipe; /* XXX - is volatile needed? */ + sig_t volatile oldsigpipe = sig_current(SIGPIPE); cmd = v; if (dot == NULL) { Index: src/usr.bin/mail/collect.c diff -u src/usr.bin/mail/collect.c:1.45 src/usr.bin/mail/collect.c:1.46 --- src/usr.bin/mail/collect.c:1.45 Sun Apr 29 19:50:22 2012 +++ src/usr.bin/mail/collect.c Tue Jun 12 15:03:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: collect.c,v 1.45 2012/04/29 23:50:22 christos Exp $ */ +/* $NetBSD: collect.c,v 1.46 2012/06/12 19:03:26 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)collect.c 8.2 (Berkeley) 4/19/94; #else -__RCSID($NetBSD: collect.c,v 1.45 2012/04/29 23:50:22 christos Exp $); +__RCSID($NetBSD: collect.c,v 1.46 2012/06/12 19:03:26 christos Exp $); #endif #endif /* not lint */ @@ -355,11 +355,11 @@ coll_stop(int signo) PUBLIC FILE * collect(struct header *hp, int printheaders) { - volatile sig_t old_sigint; - volatile sig_t old_sighup; - volatile sig_t old_sigtstp; - volatile sig_t old_sigttin; - volatile sig_t old_sigttou; + sig_t volatile old_sigint = sig_current(SIGINT); + sig_t volatile old_sighup = sig_current(SIGHUP); + sig_t volatile old_sigtstp = sig_current(SIGTSTP); + sig_t volatile old_sigttin = sig_current(SIGTTIN); + sig_t volatile old_sigttou = sig_current(SIGTTOU); FILE *fbuf; int lc, cc; int c, fd, t; Index: src/usr.bin/mail/sig.c diff -u src/usr.bin/mail/sig.c:1.2 src/usr.bin/mail/sig.c:1.3 --- src/usr.bin/mail/sig.c:1.2 Mon Jan 10 12:14:38 2011 +++ src/usr.bin/mail/sig.c Tue Jun 12 15:03:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: sig.c,v 1.2 2011/01/10 17:14:38 dyoung Exp $ */ +/* $NetBSD: sig.c,v 1.3 2012/06/12 19:03:26 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -31,7 +31,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: sig.c,v 1.2 2011/01/10 17:14:38 dyoung Exp $); +__RCSID($NetBSD: sig.c,v 1.3 2012/06/12 19:03:26 christos Exp $); #endif /* not lint */ #include assert.h @@ -162,6 +162,13 @@ sig_check(void) } PUBLIC sig_t +sig_current(int signo) +{ + assert(signo 0 signo NSIG); + return sigarray[signo]; +} + +PUBLIC sig_t sig_signal(int signo, sig_t handler) { sig_t old_handler; Index: src/usr.bin/mail/sig.h diff -u src/usr.bin/mail/sig.h:1.1 src/usr.bin/mail/sig.h:1.2 --- src/usr.bin/mail/sig.h:1.1 Fri Apr 10 09:08:25 2009 +++ src/usr.bin/mail/sig.h Tue Jun 12 15:03:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: sig.h,v 1.1 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: sig.h,v 1.2 2012/06/12 19:03:26 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -39,6 +39,7 @@ void sig_release(void); /* XXX: should void sig_check(void); void sig_setup(void); sig_t sig_signal(int, sig_t); +sig_t sig_current(int); #endif /* __SIG_H__ */
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Sun Apr 29 23:50:22 UTC 2012 Modified Files: src/usr.bin/mail: cmd1.c cmd2.c cmd3.c collect.c edit.c fio.c lex.c list.c mime_attach.c mime_child.c mime_detach.c names.c popen.c quit.c send.c support.c Log Message: set close on exec for all opened files. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.bin/mail/cmd1.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/mail/cmd2.c cvs rdiff -u -r1.41 -r1.42 src/usr.bin/mail/cmd3.c cvs rdiff -u -r1.44 -r1.45 src/usr.bin/mail/collect.c cvs rdiff -u -r1.26 -r1.27 src/usr.bin/mail/edit.c src/usr.bin/mail/list.c \ src/usr.bin/mail/popen.c cvs rdiff -u -r1.34 -r1.35 src/usr.bin/mail/fio.c cvs rdiff -u -r1.40 -r1.41 src/usr.bin/mail/lex.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/mail/mime_attach.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/mail/mime_child.c \ src/usr.bin/mail/mime_detach.c cvs rdiff -u -r1.28 -r1.29 src/usr.bin/mail/names.c cvs rdiff -u -r1.27 -r1.28 src/usr.bin/mail/quit.c cvs rdiff -u -r1.36 -r1.37 src/usr.bin/mail/send.c cvs rdiff -u -r1.23 -r1.24 src/usr.bin/mail/support.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/cmd1.c diff -u src/usr.bin/mail/cmd1.c:1.31 src/usr.bin/mail/cmd1.c:1.32 --- src/usr.bin/mail/cmd1.c:1.31 Fri Sep 16 11:39:27 2011 +++ src/usr.bin/mail/cmd1.c Sun Apr 29 19:50:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cmd1.c,v 1.31 2011/09/16 15:39:27 joerg Exp $ */ +/* $NetBSD: cmd1.c,v 1.32 2012/04/29 23:50:22 christos Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)cmd1.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: cmd1.c,v 1.31 2011/09/16 15:39:27 joerg Exp $); +__RCSID($NetBSD: cmd1.c,v 1.32 2012/04/29 23:50:22 christos Exp $); #endif #endif /* not lint */ @@ -461,7 +461,7 @@ pipecmd(void *v) goto close_pipe; sig_check(); - obuf = Popen(cmd, w); + obuf = Popen(cmd, we); if (obuf == NULL) { warn(pipecmd: Popen failed: %s, cmd); return 1; Index: src/usr.bin/mail/cmd2.c diff -u src/usr.bin/mail/cmd2.c:1.24 src/usr.bin/mail/cmd2.c:1.25 --- src/usr.bin/mail/cmd2.c:1.24 Fri Apr 10 09:08:24 2009 +++ src/usr.bin/mail/cmd2.c Sun Apr 29 19:50:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cmd2.c,v 1.24 2009/04/10 13:08:24 christos Exp $ */ +/* $NetBSD: cmd2.c,v 1.25 2012/04/29 23:50:22 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)cmd2.c 8.1 (Berkeley) 6/6/93; #else -__RCSID($NetBSD: cmd2.c,v 1.24 2009/04/10 13:08:24 christos Exp $); +__RCSID($NetBSD: cmd2.c,v 1.25 2012/04/29 23:50:22 christos Exp $); #endif #endif /* not lint */ @@ -230,7 +230,7 @@ save1(char str[], int markmsg, const cha disp = [Appended]; else disp = [New file]; - if ((obuf = Fopen(fn, a)) == NULL) { + if ((obuf = Fopen(fn, ae)) == NULL) { warn(NULL); return 1; } Index: src/usr.bin/mail/cmd3.c diff -u src/usr.bin/mail/cmd3.c:1.41 src/usr.bin/mail/cmd3.c:1.42 --- src/usr.bin/mail/cmd3.c:1.41 Sat Apr 11 10:22:32 2009 +++ src/usr.bin/mail/cmd3.c Sun Apr 29 19:50:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cmd3.c,v 1.41 2009/04/11 14:22:32 christos Exp $ */ +/* $NetBSD: cmd3.c,v 1.42 2012/04/29 23:50:22 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)cmd3.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: cmd3.c,v 1.41 2009/04/11 14:22:32 christos Exp $); +__RCSID($NetBSD: cmd3.c,v 1.42 2012/04/29 23:50:22 christos Exp $); #endif #endif /* not lint */ @@ -501,7 +501,7 @@ bounce_one(int msgno, const char **smarg (void)snprintf(mailtempname, sizeof(mailtempname), %s/mail.RsXX, tmpdir); if ((fd = mkstemp(mailtempname)) == -1 || - (obuf = Fdopen(fd, w+)) == NULL) { + (obuf = Fdopen(fd, we+)) == NULL) { if (fd != -1) (void)close(fd); warn(%s, mailtempname); Index: src/usr.bin/mail/collect.c diff -u src/usr.bin/mail/collect.c:1.44 src/usr.bin/mail/collect.c:1.45 --- src/usr.bin/mail/collect.c:1.44 Fri Sep 16 11:39:27 2011 +++ src/usr.bin/mail/collect.c Sun Apr 29 19:50:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: collect.c,v 1.44 2011/09/16 15:39:27 joerg Exp $ */ +/* $NetBSD: collect.c,v 1.45 2012/04/29 23:50:22 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)collect.c 8.2 (Berkeley) 4/19/94; #else -__RCSID($NetBSD: collect.c,v 1.44 2011/09/16 15:39:27 joerg Exp $); +__RCSID($NetBSD: collect.c,v 1.45 2012/04/29 23:50:22 christos Exp $); #endif #endif /* not lint */ @@ -97,7 +97,7 @@ exwrite(const char name[], FILE *fp, int (void)fprintf(stderr, File exists\n); return -1; } - if ((of = Fopen(name, w)) == NULL) { + if ((of = Fopen(name, we)) == NULL) { warn(%s, name); return -1; } @@ -165,7 +165,7 @@ mespipe(FILE *fp, char cmd[]) (void)snprintf(tempname,
CVS commit: src/usr.bin/mail
Module Name:src Committed By: joerg Date: Tue Feb 28 22:30:44 UTC 2012 Modified Files: src/usr.bin/mail: extern.h mime_detach.c Log Message: Mark sasprintf as using a printf-like format. Fix format string to use all arguments by telling the user what file would be overwritten. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.bin/mail/extern.h cvs rdiff -u -r1.6 -r1.7 src/usr.bin/mail/mime_detach.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/extern.h diff -u src/usr.bin/mail/extern.h:1.31 src/usr.bin/mail/extern.h:1.32 --- src/usr.bin/mail/extern.h:1.31 Fri Apr 10 13:08:24 2009 +++ src/usr.bin/mail/extern.h Tue Feb 28 22:30:44 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.31 2009/04/10 13:08:24 christos Exp $ */ +/* $NetBSD: extern.h,v 1.32 2012/02/28 22:30:44 joerg Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * @(#)extern.h 8.2 (Berkeley) 4/20/95 - * $NetBSD: extern.h,v 1.31 2009/04/10 13:08:24 christos Exp $ + * $NetBSD: extern.h,v 1.32 2012/02/28 22:30:44 joerg Exp $ */ #ifndef __EXTERN_H__ @@ -294,7 +294,7 @@ int isign(const char *, struct ignoretab void istrcpy(char *, const char *); int member(char *, struct ignoretab *); char * nameof(struct message *, int); -int sasprintf(char **ret, const char *format, ...); +int sasprintf(char **ret, const char *format, ...) __printflike(2, 3); char * savestr(const char *); struct message *set_m_flag(int, int, int); char * skin(char *); Index: src/usr.bin/mail/mime_detach.c diff -u src/usr.bin/mail/mime_detach.c:1.6 src/usr.bin/mail/mime_detach.c:1.7 --- src/usr.bin/mail/mime_detach.c:1.6 Tue May 24 12:33:22 2011 +++ src/usr.bin/mail/mime_detach.c Tue Feb 28 22:30:44 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_detach.c,v 1.6 2011/05/24 12:33:22 joerg Exp $ */ +/* $NetBSD: mime_detach.c,v 1.7 2012/02/28 22:30:44 joerg Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: mime_detach.c,v 1.6 2011/05/24 12:33:22 joerg Exp $); +__RCSID($NetBSD: mime_detach.c,v 1.7 2012/02/28 22:30:44 joerg Exp $); #endif /* not __lint__ */ #include assert.h @@ -132,7 +132,7 @@ detach_open_core(char *fname, const char if (detach_ctl.ask fd == -1 errno == EEXIST) { char *p; start: - (void)sasprintf(p, %-7s overwrite: Always/Never/once/next/rename (ANonr)[n]? , + (void)sasprintf(p, %-7s overwrite %s: Always/Never/once/next/rename (ANonr)[n]? , partstr, fname); p = my_gets(elm.string, p, NULL); if (p == NULL)
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Tue Aug 16 11:49:17 UTC 2011 Modified Files: src/usr.bin/mail: Makefile Log Message: document non-literal format string To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.bin/mail/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/Makefile diff -u src/usr.bin/mail/Makefile:1.34 src/usr.bin/mail/Makefile:1.35 --- src/usr.bin/mail/Makefile:1.34 Wed Feb 3 10:34:45 2010 +++ src/usr.bin/mail/Makefile Tue Aug 16 07:49:17 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.34 2010/02/03 15:34:45 roy Exp $ +# $NetBSD: Makefile,v 1.35 2011/08/16 11:49:17 christos Exp $ # @(#)Makefile 8.3 (Berkeley) 4/20/95 .include bsd.own.mk @@ -78,5 +78,7 @@ CONFIGFILES= mail.rc FILESDIR_mail.rc= /etc +COPTS.format.c += -Wno-format-nonliteral + .include bsd.prog.mk .include bsd.subdir.mk
CVS commit: src/usr.bin/mail
Module Name:src Committed By: joerg Date: Tue May 24 12:33:22 UTC 2011 Modified Files: src/usr.bin/mail: mime_detach.c support.c Log Message: Use proper format strings. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/mail/mime_detach.c cvs rdiff -u -r1.22 -r1.23 src/usr.bin/mail/support.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mime_detach.c diff -u src/usr.bin/mail/mime_detach.c:1.5 src/usr.bin/mail/mime_detach.c:1.6 --- src/usr.bin/mail/mime_detach.c:1.5 Fri Aug 28 14:26:50 2009 +++ src/usr.bin/mail/mime_detach.c Tue May 24 12:33:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_detach.c,v 1.5 2009/08/28 14:26:50 christos Exp $ */ +/* $NetBSD: mime_detach.c,v 1.6 2011/05/24 12:33:22 joerg Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: mime_detach.c,v 1.5 2009/08/28 14:26:50 christos Exp $); +__RCSID($NetBSD: mime_detach.c,v 1.6 2011/05/24 12:33:22 joerg Exp $); #endif /* not __lint__ */ #include assert.h @@ -166,7 +166,7 @@ return DETACH_RENAME; } } - warn(fname); + warn(%s, fname); if (fd != -1) (void)close(fd); Index: src/usr.bin/mail/support.c diff -u src/usr.bin/mail/support.c:1.22 src/usr.bin/mail/support.c:1.23 --- src/usr.bin/mail/support.c:1.22 Fri Apr 10 13:08:25 2009 +++ src/usr.bin/mail/support.c Tue May 24 12:33:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: support.c,v 1.22 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: support.c,v 1.23 2011/05/24 12:33:22 joerg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)aux.c 8.1 (Berkeley) 6/6/93; #else -__RCSID($NetBSD: support.c,v 1.22 2009/04/10 13:08:25 christos Exp $); +__RCSID($NetBSD: support.c,v 1.23 2011/05/24 12:33:22 joerg Exp $); #endif #endif /* not lint */ @@ -733,7 +733,7 @@ size_t len; if ((f = Fopen(fname, r)) == NULL) { - warn(fname); + warn(%s, fname); return; } while ((line = fgetln(f, len)) != NULL) {
CVS commit: src/usr.bin/mail
Module Name:src Committed By: dyoung Date: Mon Jan 10 17:14:38 UTC 2011 Modified Files: src/usr.bin/mail: sig.c Log Message: Rename sigqueue to sigq to avoid clashing with sigqueue(2). Now this builds again. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/mail/sig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/sig.c diff -u src/usr.bin/mail/sig.c:1.1 src/usr.bin/mail/sig.c:1.2 --- src/usr.bin/mail/sig.c:1.1 Fri Apr 10 13:08:25 2009 +++ src/usr.bin/mail/sig.c Mon Jan 10 17:14:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sig.c,v 1.1 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: sig.c,v 1.2 2011/01/10 17:14:38 dyoung Exp $ */ /* * Copyright (c) 1980, 1993 @@ -31,7 +31,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: sig.c,v 1.1 2009/04/10 13:08:25 christos Exp $); +__RCSID($NetBSD: sig.c,v 1.2 2011/01/10 17:14:38 dyoung Exp $); #endif /* not lint */ #include assert.h @@ -59,7 +59,7 @@ static struct { q_entry_t *qe_first; q_entry_t **qe_last; -} sigqueue = { NULL, sigqueue.qe_first }; +} sigq = { NULL, sigq.qe_first }; #define SIGQUEUE_INIT(p) do {\ (p)-qe_first = NULL;\ (p)-qe_last = ((p)-qe_first);\ @@ -104,7 +104,7 @@ } /* - * Attempt to post a signal to the sigqueue. + * Attempt to post a signal to the sigq. */ static void sig_post(int signo) @@ -116,13 +116,13 @@ e = alloc_entry(signo); if (e != NULL) { - *sigqueue.qe_last = e; - sigqueue.qe_last = e-qe_next; + *sigq.qe_last = e; + sigq.qe_last = e-qe_next; } } /* - * Check the sigqueue for any pending signals. If any are found, + * Check the sigq for any pending signals. If any are found, * preform the required actions and remove them from the queue. */ PUBLIC void @@ -137,16 +137,16 @@ (void)sigfillset(nset); (void)sigprocmask(SIG_SETMASK, nset, oset); - while ((e = sigqueue.qe_first) != NULL) { + while ((e = sigq.qe_first) != NULL) { signo = e-qe_signo; handler = e-qe_handler; /* * Remove the entry from the queue and free it. */ - sigqueue.qe_first = e-qe_next; - if (sigqueue.qe_first == NULL) - sigqueue.qe_last = sigqueue.qe_first; + sigq.qe_first = e-qe_next; + if (sigq.qe_first == NULL) + sigq.qe_last = sigq.qe_first; free_entry(e); if (handler == SIG_DFL || handler == SIG_IGN) { @@ -323,7 +323,7 @@ * XXX: This should be unnecessary. */ (void)memset(sigarray, 0, sizeof(sigarray)); - SIGQUEUE_INIT(sigqueue); + SIGQUEUE_INIT(sigq); /* Restore the signal mask. */ (void)sigprocmask(SIG_SETMASK, oset, NULL);
CVS commit: src/usr.bin/mail
Module Name:src Committed By: njoly Date: Thu Dec 23 20:11:00 UTC 2010 Modified Files: src/usr.bin/mail: mail.1 Log Message: Fix sub-section reference. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/usr.bin/mail/mail.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mail.1 diff -u src/usr.bin/mail/mail.1:1.58 src/usr.bin/mail/mail.1:1.59 --- src/usr.bin/mail/mail.1:1.58 Fri May 14 16:23:42 2010 +++ src/usr.bin/mail/mail.1 Thu Dec 23 20:11:00 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: mail.1,v 1.58 2010/05/14 16:23:42 joerg Exp $ +.\ $NetBSD: mail.1,v 1.59 2010/12/23 20:11:00 njoly Exp $ .\ .\ Copyright (c) 1980, 1990, 1993 .\ The Regents of the University of California. All rights reserved. @@ -2060,7 +2060,7 @@ searching sender names, subjects, or header fields (if .Ar searchheaders is defined); see the -.Sx Specifying message +.Sx Specifying messages section. The value of the variable is a space or comma delimited list of options.
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Mon Jun 21 19:49:31 UTC 2010 Modified Files: src/usr.bin/mail: mime_decode.c Log Message: - fix format print issue. from anon ymous To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.bin/mail/mime_decode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mime_decode.c diff -u src/usr.bin/mail/mime_decode.c:1.16 src/usr.bin/mail/mime_decode.c:1.17 --- src/usr.bin/mail/mime_decode.c:1.16 Fri Aug 28 10:26:50 2009 +++ src/usr.bin/mail/mime_decode.c Mon Jun 21 15:49:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_decode.c,v 1.16 2009/08/28 14:26:50 christos Exp $ */ +/* $NetBSD: mime_decode.c,v 1.17 2010/06/21 19:49:31 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: mime_decode.c,v 1.16 2009/08/28 14:26:50 christos Exp $); +__RCSID($NetBSD: mime_decode.c,v 1.17 2010/06/21 19:49:31 christos Exp $); #endif /* not __lint__ */ #include assert.h @@ -1132,7 +1132,7 @@ hdrstr = linebuf; if (colon) hdrstr = mime_decode_hfield(decbuf, sizeof(decbuf), hdrstr, hdrstr); - (void)fprintf(fo, hdrstr); + (void)fputs(hdrstr, fo); } }
CVS commit: src/usr.bin/mail
Module Name:src Committed By: joerg Date: Fri May 14 16:23:42 UTC 2010 Modified Files: src/usr.bin/mail: mail.1 Log Message: Explicitly quote |. Don't use .%T outside the scope of .Rs/.Re. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/usr.bin/mail/mail.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mail.1 diff -u src/usr.bin/mail/mail.1:1.57 src/usr.bin/mail/mail.1:1.58 --- src/usr.bin/mail/mail.1:1.57 Sun Mar 21 13:34:34 2010 +++ src/usr.bin/mail/mail.1 Fri May 14 16:23:42 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: mail.1,v 1.57 2010/03/21 13:34:34 joerg Exp $ +.\ $NetBSD: mail.1,v 1.58 2010/05/14 16:23:42 joerg Exp $ .\ .\ Copyright (c) 1980, 1990, 1993 .\ The Regents of the University of California. All rights reserved. @@ -1485,7 +1485,7 @@ If defined, the output of most commands can be piped into a shell command or redirected to a file. The pipe/redirection is signaled by the first occurrence of a -.Ql | +.Ql \| or .Ql \*[Gt] character that is not in a quoted string or in a parenthetical @@ -2283,7 +2283,7 @@ appeared in .At v6 . This man page is derived from -.%T The Mail Reference Manual +.Dq The Mail Reference Manual originally written by Kurt Shoens. .Sh BUGS There are some flags and commands that are not documented here.
CVS commit: src/usr.bin/mail
Module Name:src Committed By: joerg Date: Sun Mar 21 13:34:34 UTC 2010 Modified Files: src/usr.bin/mail: mail.1 Log Message: Use \e To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/usr.bin/mail/mail.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mail.1 diff -u src/usr.bin/mail/mail.1:1.56 src/usr.bin/mail/mail.1:1.57 --- src/usr.bin/mail/mail.1:1.56 Fri Apr 10 13:08:25 2009 +++ src/usr.bin/mail/mail.1 Sun Mar 21 13:34:34 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: mail.1,v 1.56 2009/04/10 13:08:25 christos Exp $ +.\ $NetBSD: mail.1,v 1.57 2010/03/21 13:34:34 joerg Exp $ .\ .\ Copyright (c) 1980, 1990, 1993 .\ The Regents of the University of California. All rights reserved. @@ -827,9 +827,9 @@ For example, one use might be something like: .Bd -literal -offset 0 if headersonly - set header-format=%P%Q%3i %-21.20f %m/%d %R %3K \\%q\\ + set header-format=%P%Q%3i %-21.20f %m/%d %R %3K \e%q\e else - set header-format=%P%Q%?\*[Am] ?%3i %-21.20f %a %b %e %R %3K/%-5O \\%q\\ + set header-format=%P%Q%?\*[Am] ?%3i %-21.20f %a %b %e %R %3K/%-5O \e%q\e endif .Ed .It Ic ifdef @@ -1875,7 +1875,7 @@ header falling back to the headline if that extraction fails. For example, the default format is: .Bd -literal -offset 0 -set header-format=\\%??%P%Q%?* ?%3i \%-21.20f \%a \%b \%e \%R \%3K/%-5O \\\%q\\ +set header-format=\\%??%P%Q%?* ?%3i \%-21.20f \%a \%b \%e \%R \%3K/%-5O \\e%q\e .Ed .Pp Note 1: The message status flag @@ -1907,7 +1907,7 @@ .Ar \%t as used by .Xr strftime 3 -were redundant with \\t and \\n, respectively, so nothing is lost +were redundant with \et and \en, respectively, so nothing is lost using them here. .It Ar ignoreeof An option related to @@ -1941,7 +1941,7 @@ For example, the following: .Bd -literal -offset 0 set indentpreamble= - \On \%b \%e \%T, \%Y \%z (%Z), \%n (%.50N) wrote:\\n-- Subject: \%.65q\\n + \On \%b \%e \%T, \%Y \%z (%Z), \%n (%.50N) wrote:\en-- Subject: \%.65q\en .Ed .Pp would insert something like
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Tue Jan 12 14:43:32 UTC 2010 Modified Files: src/usr.bin/mail: popen.c Log Message: - 1 - EXIT_FAILURE - preallocate child struct, since the signal handler can be called before wait_child, and we cannot allocate a child struct there. there is a signal race still here if the program exits and the signal handler is called before we allocate the struct. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.bin/mail/popen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/popen.c diff -u src/usr.bin/mail/popen.c:1.25 src/usr.bin/mail/popen.c:1.26 --- src/usr.bin/mail/popen.c:1.25 Fri Apr 10 09:08:25 2009 +++ src/usr.bin/mail/popen.c Tue Jan 12 09:43:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: popen.c,v 1.25 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: popen.c,v 1.26 2010/01/12 14:43:31 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)popen.c 8.1 (Berkeley) 6/6/93; #else -__RCSID($NetBSD: popen.c,v 1.25 2009/04/10 13:08:25 christos Exp $); +__RCSID($NetBSD: popen.c,v 1.26 2010/01/12 14:43:31 christos Exp $); #endif #endif /* not lint */ @@ -67,6 +67,7 @@ struct child *link; }; static struct child *child, *child_freelist = NULL; +static struct child *findchild(pid_t, int); #if 0 /* XXX - debugging stuff. This should go away eventually! */ @@ -104,7 +105,7 @@ (void)free(p); return; } - errx(1, Invalid file pointer); + errx(EXIT_FAILURE, Invalid file pointer); } PUBLIC void @@ -220,6 +221,7 @@ warn(%s, argv[0]); _exit(1); } + (void)findchild(pid, 0); return pid; } @@ -348,7 +350,7 @@ for (p = fp_head; p; p = p-link) if (p-fp == fp) return p-pid; - errx(1, Invalid file pointer); + errx(EXIT_FAILURE, Invalid file pointer); /*NOTREACHED*/ }
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Tue Jan 12 14:44:24 UTC 2010 Modified Files: src/usr.bin/mail: complete.c Log Message: - 1 - EXIT_FAILURE - avoid assertion firing when hitting ^D in CC: line. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/mail/complete.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/complete.c diff -u src/usr.bin/mail/complete.c:1.19 src/usr.bin/mail/complete.c:1.20 --- src/usr.bin/mail/complete.c:1.19 Fri Apr 10 09:08:24 2009 +++ src/usr.bin/mail/complete.c Tue Jan 12 09:44:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: complete.c,v 1.19 2009/04/10 13:08:24 christos Exp $ */ +/* $NetBSD: complete.c,v 1.20 2010/01/12 14:44:24 christos Exp $ */ /*- * Copyright (c) 1997-2000,2005,2006 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: complete.c,v 1.19 2009/04/10 13:08:24 christos Exp $); +__RCSID($NetBSD: complete.c,v 1.20 2010/01/12 14:44:24 christos Exp $); #endif /* not lint */ /* @@ -178,7 +178,7 @@ p = sl_init(); if (p == NULL) - err(1, Unable to allocate memory for stringlist); + err(EXIT_FAILURE, Unable to allocate memory for stringlist); return p; } @@ -191,7 +191,7 @@ { if (sl_add(sl, i) == -1) - err(1, Unable to add `%s' to stringlist, i); + err(EXIT_FAILURE, Unable to add `%s' to stringlist, i); } @@ -1143,12 +1143,13 @@ return NULL; } - assert(cnt 0); - if (buf[cnt - 1] == '\n') - cnt--; /* trash the trailing LF */ + if (cnt 0) { + if (buf[cnt - 1] == '\n') + cnt--; /* trash the trailing LF */ - len = MIN(sizeof(line) - 1, (size_t)cnt); - (void)memcpy(line, buf, len); + len = MIN(sizeof(line) - 1, (size_t)cnt); + (void)memcpy(line, buf, len); + } line[cnt] = '\0'; /* enter non-empty lines into history */
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Tue Jan 12 14:45:31 UTC 2010 Modified Files: src/usr.bin/mail: fio.c lex.c list.c main.c names.c strings.c temp.c Log Message: error message cleanup - 1 - EXIT_FAILURE - fprintf(stderr, - warnx( - better warning messages To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.bin/mail/fio.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/mail/lex.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/mail/list.c cvs rdiff -u -r1.30 -r1.31 src/usr.bin/mail/main.c cvs rdiff -u -r1.27 -r1.28 src/usr.bin/mail/names.c cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mail/strings.c cvs rdiff -u -r1.21 -r1.22 src/usr.bin/mail/temp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/fio.c diff -u src/usr.bin/mail/fio.c:1.33 src/usr.bin/mail/fio.c:1.34 --- src/usr.bin/mail/fio.c:1.33 Sat Apr 11 10:22:32 2009 +++ src/usr.bin/mail/fio.c Tue Jan 12 09:45:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fio.c,v 1.33 2009/04/11 14:22:32 christos Exp $ */ +/* $NetBSD: fio.c,v 1.34 2010/01/12 14:45:31 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)fio.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: fio.c,v 1.33 2009/04/11 14:22:32 christos Exp $); +__RCSID($NetBSD: fio.c,v 1.34 2010/01/12 14:45:31 christos Exp $); #endif #endif /* not lint */ @@ -130,7 +130,8 @@ size = (nmsgCount + 1) * sizeof(*nmessage); nmessage = realloc(omessage, size); if (nmessage == NULL) - err(1, Insufficient memory for %d messages, nmsgCount); + err(EXIT_FAILURE, + Insufficient memory for %d messages, nmsgCount); if (omsgCount == 0 || omessage == NULL) dot = nmessage; else @@ -350,7 +351,7 @@ (void)fflush(otf); if (fseek(itf, (long)positionof(mp-m_block, mp-m_offset), SEEK_SET) 0) - err(1, fseek); + err(EXIT_FAILURE, fseek); return itf; } @@ -476,7 +477,7 @@ l = read(pivec[0], xname, sizeof(xname)); (void)close(pivec[0]); if (wait_child(pid) 0 WTERMSIG(wait_status) != SIGPIPE) { - (void)fprintf(stderr, \%s\: Expansion failed.\n, name); + warnx(Expansion `%s' failed [%x], cmdbuf, wait_status); return NULL; } if (l 0) { @@ -484,11 +485,11 @@ return NULL; } if (l == 0) { - (void)fprintf(stderr, \%s\: No match.\n, name); + warnx(No match for `%s', name); return NULL; } if (l == sizeof(xname)) { - (void)fprintf(stderr, \%s\: Expansion buffer overflow.\n, name); + warnx(Expansion buffer overflow for `%s', name); return NULL; } xname[l] = '\0'; @@ -496,7 +497,7 @@ continue; cp[1] = '\0'; if (strchr(xname, ' ') stat(xname, sbuf) 0) { - (void)fprintf(stderr, \%s\: Ambiguous.\n, name); + warnx(Ambiguous expansion for `%s', name); return NULL; } return savestr(xname); Index: src/usr.bin/mail/lex.c diff -u src/usr.bin/mail/lex.c:1.38 src/usr.bin/mail/lex.c:1.39 --- src/usr.bin/mail/lex.c:1.38 Tue Jul 14 17:15:48 2009 +++ src/usr.bin/mail/lex.c Tue Jan 12 09:45:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.38 2009/07/14 21:15:48 apb Exp $ */ +/* $NetBSD: lex.c,v 1.39 2010/01/12 14:45:31 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)lex.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: lex.c,v 1.38 2009/07/14 21:15:48 apb Exp $); +__RCSID($NetBSD: lex.c,v 1.39 2010/01/12 14:45:31 christos Exp $); #endif #endif /* not lint */ @@ -176,7 +176,7 @@ if ((ibuf = Fopen(name, r)) == NULL) { if (!isedit errno == ENOENT) goto nomail; - warn(%s, name); + warn(Can't open `%s', name); return -1; } @@ -239,10 +239,10 @@ %s/mail.RxXX, tmpdir); if ((fd = mkstemp(tempname)) == -1 || (otf = fdopen(fd, w)) == NULL) - err(1, %s, tempname); + err(EXIT_FAILURE, Can't create tmp file `%s', tempname); (void)fcntl(fileno(otf), F_SETFD, FD_CLOEXEC); if ((itf = fopen(tempname, r)) == NULL) - err(1, %s, tempname); + err(EXIT_FAILURE, Can't create tmp file `%s', tempname); (void)fcntl(fileno(itf), F_SETFD, FD_CLOEXEC); (void)rm(tempname); setptr(ibuf, (off_t)0); @@ -747,7 +747,7 @@ break; default: - errx(1, Unknown argtype); + errx(EXIT_FAILURE, Unknown argtype); } out: Index: src/usr.bin/mail/list.c diff -u src/usr.bin/mail/list.c:1.25 src/usr.bin/mail/list.c:1.26 --- src/usr.bin/mail/list.c:1.25 Fri Apr 10 09:08:25 2009 +++ src/usr.bin/mail/list.c Tue Jan 12 09:45:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: list.c,v 1.25 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: list.c,v 1.26 2010/01/12 14:45:31 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)list.c 8.4 (Berkeley) 5/1/95; #else -__RCSID($NetBSD: list.c,v 1.25 2009/04/10 13:08:25 christos Exp $); +__RCSID($NetBSD: list.c,v 1.26 2010/01/12 14:45:31 christos Exp $); #endif #endif /* not lint */ @@ -427,7 +427,7 @@ regret(int token) {
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Fri Aug 28 14:26:50 UTC 2009 Modified Files: src/usr.bin/mail: mime_decode.c mime_detach.c Log Message: Don't barf on malformed mime messages (missing mime version). From Anon Ymous To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mail/mime_decode.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/mail/mime_detach.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/mime_decode.c diff -u src/usr.bin/mail/mime_decode.c:1.15 src/usr.bin/mail/mime_decode.c:1.16 --- src/usr.bin/mail/mime_decode.c:1.15 Fri Apr 10 09:08:25 2009 +++ src/usr.bin/mail/mime_decode.c Fri Aug 28 10:26:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_decode.c,v 1.15 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: mime_decode.c,v 1.16 2009/08/28 14:26:50 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: mime_decode.c,v 1.15 2009/04/10 13:08:25 christos Exp $); +__RCSID($NetBSD: mime_decode.c,v 1.16 2009/08/28 14:26:50 christos Exp $); #endif /* not __lint__ */ #include assert.h @@ -266,8 +266,15 @@ filename = savestr(filename); /* save it! */ } mip-mi_filename = filename; -} + /* + * XXX: If we have a Content-Type in the header, then assume + * we also have a MIME-Version: 1.0. This fixes some broken + * MIME headers that I have seen occasionally. + */ + if (mip-mi_version == NULL mip-mi_type != NULL) + mip-mi_version = MIME_VERSION; +} static struct message * salloc_message(int flag, long block, short offset) Index: src/usr.bin/mail/mime_detach.c diff -u src/usr.bin/mail/mime_detach.c:1.4 src/usr.bin/mail/mime_detach.c:1.5 --- src/usr.bin/mail/mime_detach.c:1.4 Fri Apr 10 09:08:25 2009 +++ src/usr.bin/mail/mime_detach.c Fri Aug 28 10:26:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: mime_detach.c,v 1.4 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: mime_detach.c,v 1.5 2009/08/28 14:26:50 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include sys/cdefs.h #ifndef __lint__ -__RCSID($NetBSD: mime_detach.c,v 1.4 2009/04/10 13:08:25 christos Exp $); +__RCSID($NetBSD: mime_detach.c,v 1.5 2009/08/28 14:26:50 christos Exp $); #endif /* not __lint__ */ #include assert.h @@ -178,26 +178,36 @@ { char *pathname; char *prompt; + const char *partstr; + const char *subtype; + + /* + * XXX: If partstr == NULL, we probably shouldn't be detaching + * anything, but let's be liberal and try to do something with + * the block anyway. + */ + partstr = mip-mi_partstr mip-mi_partstr[0] ? mip-mi_partstr : 0; + subtype = mip-mi_subtype ? mip-mi_subtype : unknown; /* * Get the suggested target pathname. */ if (mip-mi_filename != NULL) - (void)sasprintf(pathname, %s/%s, mip-mi_detachdir, mip-mi_filename); + (void)sasprintf(pathname, %s/%s, mip-mi_detachdir, + mip-mi_filename); else { if (mip-mi_detachall == 0) return NULL; (void)sasprintf(pathname, %s/msg-%s.part-%s.%s, mip-mi_detachdir, mip-mi_msgstr, - mip-mi_partstr[0] ? mip-mi_partstr : 0, - mip-mi_subtype ? mip-mi_subtype : unknown); + partstr, subtype); } /* * Make up the prompt */ - (void)sasprintf(prompt, %-7s filename: , mip-mi_partstr); + (void)sasprintf(prompt, %-7s filename: , partstr); /* * The main loop. @@ -218,7 +228,7 @@ return NULL; continue; } - switch (detach_open_core(fname, mip-mi_partstr)) { + switch (detach_open_core(fname, partstr)) { case DETACH_OPEN_OK: return fname; case DETACH_NEXT:
CVS commit: src/usr.bin/mail
Module Name:src Committed By: apb Date: Tue Jul 14 21:15:48 UTC 2009 Modified Files: src/usr.bin/mail: lex.c Log Message: Declare com as volatile in execute(), to make it safe to use across setjmp/longjmp. Inspired by PR 41255 from Kurt Lidl, but this change makes com a volatile pointer to const non-volatile data, whereas the PR made it a non-volatile pointer to const volatile data. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/mail/lex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/lex.c diff -u src/usr.bin/mail/lex.c:1.37 src/usr.bin/mail/lex.c:1.38 --- src/usr.bin/mail/lex.c:1.37 Fri Apr 10 13:08:25 2009 +++ src/usr.bin/mail/lex.c Tue Jul 14 21:15:48 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.37 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: lex.c,v 1.38 2009/07/14 21:15:48 apb Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)lex.c 8.2 (Berkeley) 4/20/95; #else -__RCSID($NetBSD: lex.c,v 1.37 2009/04/10 13:08:25 christos Exp $); +__RCSID($NetBSD: lex.c,v 1.38 2009/07/14 21:15:48 apb Exp $); #endif #endif /* not lint */ @@ -585,7 +585,7 @@ { char *word; char *arglist[MAXARGC]; - const struct cmd *com = NULL; + const struct cmd * volatile com = NULL; char *volatile cp; int retval; int c;
CVS commit: src/usr.bin/mail
Module Name:src Committed By: he Date: Mon Apr 13 10:03:58 UTC 2009 Modified Files: src/usr.bin/mail: send.c Log Message: Do the -Wuninitialized workaround in a way which conforms to our style guide, and remove a now unneeded LINTED comment. From private feedback. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.bin/mail/send.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/send.c diff -u src/usr.bin/mail/send.c:1.35 src/usr.bin/mail/send.c:1.36 --- src/usr.bin/mail/send.c:1.35 Sun Apr 12 22:47:39 2009 +++ src/usr.bin/mail/send.c Mon Apr 13 10:03:58 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: send.c,v 1.35 2009/04/12 22:47:39 he Exp $ */ +/* $NetBSD: send.c,v 1.36 2009/04/13 10:03:58 he Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)send.c 8.1 (Berkeley) 6/6/93; #else -__RCSID($NetBSD: send.c,v 1.35 2009/04/12 22:47:39 he Exp $); +__RCSID($NetBSD: send.c,v 1.36 2009/04/13 10:03:58 he Exp $); #endif #endif /* not lint */ @@ -655,16 +655,16 @@ ncopy(struct name *np) { struct name *rv; - struct name *lp = NULL; /* XXX gcc -Wuninitialized sh3 */ + struct name *lp; struct name *tp; + lp = NULL; /* XXX gcc -Wuninitialized sh3 */ rv = NULL; for (/*EMPTY*/; np; np = np-n_flink) { tp = nalloc(np-n_name, np-n_type); if (rv == NULL) rv = tp; else { - /*LINTED*/ lp-n_flink = tp; tp-n_blink = lp; }
CVS commit: src/usr.bin/mail
Module Name:src Committed By: he Date: Sun Apr 12 22:47:39 UTC 2009 Modified Files: src/usr.bin/mail: send.c Log Message: Work around a problem with gcc -Wuninitialized seen for our sh3 targets. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.bin/mail/send.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/mail/send.c diff -u src/usr.bin/mail/send.c:1.34 src/usr.bin/mail/send.c:1.35 --- src/usr.bin/mail/send.c:1.34 Fri Apr 10 13:08:25 2009 +++ src/usr.bin/mail/send.c Sun Apr 12 22:47:39 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: send.c,v 1.34 2009/04/10 13:08:25 christos Exp $ */ +/* $NetBSD: send.c,v 1.35 2009/04/12 22:47:39 he Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)send.c 8.1 (Berkeley) 6/6/93; #else -__RCSID($NetBSD: send.c,v 1.34 2009/04/10 13:08:25 christos Exp $); +__RCSID($NetBSD: send.c,v 1.35 2009/04/12 22:47:39 he Exp $); #endif #endif /* not lint */ @@ -655,7 +655,7 @@ ncopy(struct name *np) { struct name *rv; - struct name *lp; + struct name *lp = NULL; /* XXX gcc -Wuninitialized sh3 */ struct name *tp; rv = NULL;