Introduce a -b option for sites who are not interested in the old biff
service. (Avoid a ``in_vain'' warning...)
This commit is contained in:
parent
062c4e5ca5
commit
5e814ff6c2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15235
@ -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
|
||||
|
@ -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 @@ deliver(fd, name)
|
||||
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__
|
||||
|
Loading…
Reference in New Issue
Block a user