Allow mail(1) to look for multiple mail.rc files.

Submitted-By: Lyndon Nerenberg VE7TCP <lyndon@orthanc.com>
This commit is contained in:
Jordan K. Hubbard 1996-12-21 22:53:58 +00:00
parent 441c428f70
commit e9b074c385
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=20778
3 changed files with 29 additions and 12 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)mail.1 8.2 (Berkeley) 12/30/93
.\" $Id: mail.1,v 1.7 1996/08/29 18:05:57 wosch Exp $
.\" $Id: mail.1,v 1.8 1996/10/06 01:55:31 jkh Exp $
.\"
.Dd December 30, 1993
.Dt MAIL 1
@ -78,9 +78,9 @@ In particular, the
special
character when sending mail is only active in interactive mode.
.It Fl n
Inhibits reading
.Pa /etc/mail.rc
upon startup.
Inhibits reading the system-wide
.Pa mail.rc
files upon startup.
.It Fl N
Inhibits the initial display of message headers
when reading mail or editing a mail folder.
@ -797,8 +797,9 @@ The binary options include the following:
Causes messages saved in
.Ar mbox
to be appended to the end rather than prepended.
This should always be set (perhaps in
.Pa /etc/mail.rc ) .
This should always be set (preferably in one of the system-wide
.Pa mail.rc
files).
.It Ar ask
Causes
.Nm mail
@ -991,7 +992,7 @@ environment variable is set, it is used as the
location of the user's mailbox instead of the
default in /var/mail.
.Sh FILES
.Bl -tag -width /usr/share/misc/Mail.help* -compact
.Bl -tag -width /usr/share/misc/mail.*help -compact
.It Pa /var/mail/*
Post office.
.It ~/mbox
@ -1000,10 +1001,14 @@ User's old mail.
File giving initial mail commands.
.It Pa /tmp/R*
Temporary files.
.It Pa /usr/share/misc/mail.help
.It Pa /usr/share/misc/mail.*help
Help files.
.sp
.It Pa /usr/share/misc/mail.rc
.It Pa /usr/local/etc/mail.rc
.It Pa /etc/mail.rc
System initialization file.
System-wide initialization files. Each file will be sourced, in order,
if it exists.
.El
.Sh SEE ALSO
.Xr fmt 1 ,

View File

@ -42,6 +42,7 @@ static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif /* not lint */
#include "rcv.h"
#include <err.h>
#include <fcntl.h>
#include "extern.h"
@ -207,8 +208,19 @@ Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
input = stdin;
rcvmode = !to;
spreserve();
if (!nosrc)
load(_PATH_MASTER_RC);
if (!nosrc) {
char *s, *path_rc;
path_rc = malloc(sizeof(_PATH_MASTER_RC));
if (path_rc == NULL)
errx(1, "malloc(path_rc) failed");
strcpy(path_rc, _PATH_MASTER_RC);
while ((s = strsep(&path_rc, ":")) != NULL)
if (*s != '\0')
load(s);
}
/*
* Expand returns a savestr, but load only uses the file name
* for fopen, so it's safe to do this.

View File

@ -38,5 +38,5 @@
#define _PATH_EX "/usr/bin/ex"
#define _PATH_HELP "/usr/share/misc/mail.help"
#define _PATH_TILDE "/usr/share/misc/mail.tildehelp"
#define _PATH_MASTER_RC "/etc/mail.rc"
#define _PATH_MASTER_RC "/usr/share/misc/mail.rc:/usr/local/etc/mail.rc:/etc/mail.rc"
#define _PATH_MORE "/usr/bin/more"