diff options
author | joerg <joerg@FreeBSD.org> | 1996-04-13 11:44:12 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1996-04-13 11:44:12 +0000 |
commit | 0a6e60012a6e2358cc8998602acd003037795f09 (patch) | |
tree | 838f0b933e4ba36557dde1a720fb0113cfa177ba /libexec/mail.local | |
parent | cb414e0b3ed97a6a4538cf2ef2de71f2d23265e8 (diff) | |
download | FreeBSD-src-0a6e60012a6e2358cc8998602acd003037795f09.zip FreeBSD-src-0a6e60012a6e2358cc8998602acd003037795f09.tar.gz |
Introduce a -b option for sites who are not interested in the old biff
service. (Avoid a ``in_vain'' warning...)
Diffstat (limited to 'libexec/mail.local')
-rw-r--r-- | libexec/mail.local/mail.local.8 | 5 | ||||
-rw-r--r-- | libexec/mail.local/mail.local.c | 30 |
2 files changed, 24 insertions, 11 deletions
diff --git a/libexec/mail.local/mail.local.8 b/libexec/mail.local/mail.local.8 index 81eff78..979cd44 100644 --- a/libexec/mail.local/mail.local.8 +++ b/libexec/mail.local/mail.local.8 @@ -40,6 +40,7 @@ .Sh SYNOPSIS .Nm mail.local .Op Fl f Ar from +.Op Fl b .Ar user ... .Sh DESCRIPTION .Nm Mail.local @@ -55,6 +56,10 @@ The options are as follows: .Bl -tag -width xxxfrom .It Fl f Ar from Specify the sender's name. +.It Fl b +Turn off the attempts to notify the +.Dq biff +service. .El .Pp Individual mail messages in the mailbox are delimited by an empty diff --git a/libexec/mail.local/mail.local.c b/libexec/mail.local/mail.local.c index 0d80972..60df974 100644 --- a/libexec/mail.local/mail.local.c +++ b/libexec/mail.local/mail.local.c @@ -69,7 +69,7 @@ static char sccsid[] = "@(#)mail.local.c 8.6 (Berkeley) 4/8/94"; int eval = EX_OK; /* sysexits.h error value. */ -void deliver __P((int, char *)); +void deliver __P((int, char *, int)); void e_to_sys __P((int)); __dead void err __P((const char *, ...)); void notifybiff __P((char *)); @@ -84,15 +84,19 @@ main(argc, argv) char *argv[]; { struct passwd *pw; - int ch, fd; + int ch, fd, nobiff; uid_t uid; char *from; openlog("mail.local", 0, LOG_MAIL); from = NULL; - while ((ch = getopt(argc, argv, "df:r:")) != EOF) + nobiff = 0; + while ((ch = getopt(argc, argv, "bdf:r:")) != EOF) switch(ch) { + case 'b': + nobiff++; + break; case 'd': /* Backward compatible. */ break; case 'f': @@ -133,7 +137,7 @@ main(argc, argv) * at the expense of repeated failures and multiple deliveries. */ for (fd = store(from); *argv; ++argv) - deliver(fd, *argv); + deliver(fd, *argv, nobiff); exit(eval); } @@ -188,8 +192,8 @@ store(from) } void -deliver(fd, name) - int fd; +deliver(fd, name, nobiff) + int fd, nobiff; char *name; { struct stat fsb, sb; @@ -273,9 +277,12 @@ tryagain: goto err1; } - /* Get the starting offset of the new message for biff. */ - curoff = lseek(mbfd, (off_t)0, SEEK_END); - (void)snprintf(biffmsg, sizeof(biffmsg), "%s@%qd\n", name, curoff); + if (!nobiff) { + /* Get the starting offset of the new message for biff. */ + curoff = lseek(mbfd, (off_t)0, SEEK_END); + (void)snprintf(biffmsg, sizeof(biffmsg), "%s@%qd\n", + name, curoff); + } /* Copy the message into the file. */ if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) { @@ -314,7 +321,8 @@ err1: (void)close(mbfd); return; } - notifybiff(biffmsg); + if (!nobiff) + notifybiff(biffmsg); } void @@ -353,7 +361,7 @@ void usage() { eval = EX_USAGE; - err("usage: mail.local [-f from] user ..."); + err("usage: mail.local [-b] [-f from] user ..."); } #if __STDC__ |