summaryrefslogtreecommitdiff
path: root/libexec/mail.local
diff options
context:
space:
mode:
authordm <dm@cvs.openbsd.org>1996-08-27 03:18:01 +0000
committerdm <dm@cvs.openbsd.org>1996-08-27 03:18:01 +0000
commit69993b43f2f7c55a601714bcbc35bc1409fa3c89 (patch)
treef9d822a81188fd3b963ece7e6260a88b06bf3397 /libexec/mail.local
parent9fe2d69ebd8f951a7c9be37909ae3a774948fde3 (diff)
Use lockfiles by default, rather than fcntl.
Diffstat (limited to 'libexec/mail.local')
-rw-r--r--libexec/mail.local/mail.local.820
-rw-r--r--libexec/mail.local/mail.local.c11
2 files changed, 20 insertions, 11 deletions
diff --git a/libexec/mail.local/mail.local.8 b/libexec/mail.local/mail.local.8
index 10d78007a1b..ed7263abb75 100644
--- a/libexec/mail.local/mail.local.8
+++ b/libexec/mail.local/mail.local.8
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)mail.local.8 6.8 (Berkeley) 4/27/91
-.\" $Id: mail.local.8,v 1.1 1995/10/18 08:43:19 deraadt Exp $
+.\" $Id: mail.local.8,v 1.2 1996/08/27 03:17:57 dm Exp $
.\"
.Dd April 27, 1991
.Dt MAIL.LOCAL 8
@@ -40,6 +40,7 @@
.Nd store mail in a mailbox
.Sh SYNOPSIS
.Nm mail.local
+.Op Fl L
.Op Fl l
.Op Fl f Ar from
.Ar user ...
@@ -58,9 +59,14 @@ The options are as follows:
.It Fl f Ar from
Specify the sender's name.
.It Fl l
-Request that
+For compatibility, request that
.Nm username.lock
-files be used for locking.
+files be used for locking. (This done by default anyway.)
+.It Fl L
+Request that
+.Fn flock
+be used for locking the mail spool rather than
+.Nm username.lock .
.El
.Pp
Individual mail messages in the mailbox are delimited by an empty
@@ -71,11 +77,11 @@ A blank line is appended to each message.
A greater-than character (``>'') is prepended to any line in the message
which could be mistaken for a ``From '' delimiter line.
.Pp
-If the
-.Op Fl l
-flag is specified mailbox locking is done with
+By default, mailbox locking is done with
.Nm username.lock
-files. Otherwise, the mailbox is exclusively locked with
+files. However, if the
+.Fl -L
+flag is specified, the mailbox is exclusively locked with
.Xr flock 2
while mail is appended.
.Pp
diff --git a/libexec/mail.local/mail.local.c b/libexec/mail.local/mail.local.c
index d609219162d..747df1cb1b6 100644
--- a/libexec/mail.local/mail.local.c
+++ b/libexec/mail.local/mail.local.c
@@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)mail.local.c 5.6 (Berkeley) 6/19/91";*/
-static char rcsid[] = "$Id: mail.local.c,v 1.2 1996/07/19 07:35:18 deraadt Exp $";
+static char rcsid[] = "$Id: mail.local.c,v 1.3 1996/08/27 03:18:00 dm Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -74,14 +74,14 @@ main(argc, argv)
extern int optind;
extern char *optarg;
struct passwd *pw;
- int ch, fd, eval, lockfile=0;
+ int ch, fd, eval, lockfile=1;
uid_t uid;
char *from;
openlog("mail.local", LOG_PERROR, LOG_MAIL);
from = NULL;
- while ((ch = getopt(argc, argv, "ldf:r:")) != EOF)
+ while ((ch = getopt(argc, argv, "lLdf:r:")) != EOF)
switch(ch) {
case 'd': /* backward compatible */
break;
@@ -92,7 +92,10 @@ main(argc, argv)
from = optarg;
break;
case 'l':
- lockfile++;
+ lockfile=1;
+ break;
+ case 'L':
+ lockfile=0;
break;
case '?':
default: