Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/mail Add -E "dontsendempty" flag which does not send...
details: https://anonhg.NetBSD.org/src/rev/b4f0e3ade7ea
branches: trunk
changeset: 497095:b4f0e3ade7ea
user: christos <christos%NetBSD.org@localhost>
date: Tue Sep 19 01:12:48 2000 +0000
description:
Add -E "dontsendempty" flag which does not send messages that have no
data. This is useful when piping cron error output to mail. While I am
there add -~ to be a synonym for -I [but don't document it]. This is for
compatibility with other OS's.
diffstat:
usr.bin/mail/mail.1 | 11 +++++++----
usr.bin/mail/main.c | 19 +++++++++++++------
usr.bin/mail/send.c | 6 ++++--
3 files changed, 24 insertions(+), 12 deletions(-)
diffs (124 lines):
diff -r 7382ebc05752 -r b4f0e3ade7ea usr.bin/mail/mail.1
--- a/usr.bin/mail/mail.1 Tue Sep 19 01:11:38 2000 +0000
+++ b/usr.bin/mail/mail.1 Tue Sep 19 01:12:48 2000 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mail.1,v 1.16 2000/05/05 18:21:06 itojun Exp $
+.\" $NetBSD: mail.1,v 1.17 2000/09/19 01:12:48 christos Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -43,17 +43,17 @@
.Nd send and receive mail
.Sh SYNOPSIS
.Nm
-.Op Fl iInv
+.Op Fl EiInv
.Op Fl s Ar subject
.Op Fl c Ar cc-addr
.Op Fl b Ar bcc-addr
.Ar to-addr...
.Nm ""
-.Op Fl iInNv
+.Op Fl EiInNv
.Fl f
.Op Ar name
.Nm ""
-.Op Fl iInNv
+.Op Fl EiInNv
.Op Fl u Ar user
.Sh INTRODUCTION
.Nm
@@ -67,6 +67,9 @@
Verbose mode.
The details of
delivery are displayed on the user's terminal.
+.It Fl E
+Don't send messages with an empty body. This is useful
+for piping errors from cron scripts.
.It Fl i
Ignore tty interrupt signals.
This is
diff -r 7382ebc05752 -r b4f0e3ade7ea usr.bin/mail/main.c
--- a/usr.bin/mail/main.c Tue Sep 19 01:11:38 2000 +0000
+++ b/usr.bin/mail/main.c Tue Sep 19 01:12:48 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.10 1999/02/09 04:51:30 dean Exp $ */
+/* $NetBSD: main.c,v 1.11 2000/09/19 01:12:48 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/20/95";
#else
-__RCSID("$NetBSD: main.c,v 1.10 1999/02/09 04:51:30 dean Exp $");
+__RCSID("$NetBSD: main.c,v 1.11 2000/09/19 01:12:48 christos Exp $");
#endif
#endif /* not lint */
@@ -98,7 +98,7 @@
bcc = NIL;
smopts = NIL;
subject = NOSTR;
- while ((i = getopt(argc, argv, "INT:b:c:dfins:u:v")) != -1) {
+ while ((i = getopt(argc, argv, "~EINT:b:c:dfins:u:v")) != -1) {
switch (i) {
case 'T':
/*
@@ -170,6 +170,7 @@
assign("verbose", "");
break;
case 'I':
+ case '~':
/*
* We're interactive
*/
@@ -187,12 +188,18 @@
*/
bcc = cat(bcc, nalloc(optarg, GBCC));
break;
+ case 'E':
+ /*
+ * Don't send empty files.
+ */
+ assign("dontsendempty", "");
+ break;
case '?':
fputs("\
-Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
+Usage: mail [-EiInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
[- sendmail-options ...]\n\
- mail [-iInNv] -f [name]\n\
- mail [-iInNv] [-u user]\n",
+ mail [-EiInNv] -f [name]\n\
+ mail [-EiInNv] [-u user]\n",
stderr);
exit(1);
}
diff -r 7382ebc05752 -r b4f0e3ade7ea usr.bin/mail/send.c
--- a/usr.bin/mail/send.c Tue Sep 19 01:11:38 2000 +0000
+++ b/usr.bin/mail/send.c Tue Sep 19 01:12:48 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: send.c,v 1.11 2000/02/10 12:34:44 tron Exp $ */
+/* $NetBSD: send.c,v 1.12 2000/09/19 01:12:48 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)send.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: send.c,v 1.11 2000/02/10 12:34:44 tron Exp $");
+__RCSID("$NetBSD: send.c,v 1.12 2000/09/19 01:12:48 christos Exp $");
#endif
#endif /* not lint */
@@ -328,6 +328,8 @@
}
}
if (fsize(mtf) == 0) {
+ if (value("dontsendempty") != NOSTR)
+ goto out;
if (hp->h_subject == NOSTR)
printf("No message, no subject; hope that's ok\n");
else
Home |
Main Index |
Thread Index |
Old Index