summaryrefslogtreecommitdiffstats
path: root/usr.bin/mail/main.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-12-21 22:53:58 +0000
committerjkh <jkh@FreeBSD.org>1996-12-21 22:53:58 +0000
commitad3a46d18ba9b4fae98b615a912d155f1008d49e (patch)
tree8fbac8a33712ca7bbc9927420b6fe408b86a2d59 /usr.bin/mail/main.c
parentc04fa8bd61fb25f041272c83ac491af91cdb9deb (diff)
downloadFreeBSD-src-ad3a46d18ba9b4fae98b615a912d155f1008d49e.zip
FreeBSD-src-ad3a46d18ba9b4fae98b615a912d155f1008d49e.tar.gz
Allow mail(1) to look for multiple mail.rc files.
Submitted-By: Lyndon Nerenberg VE7TCP <lyndon@orthanc.com>
Diffstat (limited to 'usr.bin/mail/main.c')
-rw-r--r--usr.bin/mail/main.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/usr.bin/mail/main.c b/usr.bin/mail/main.c
index e912ccb..6a01754 100644
--- a/usr.bin/mail/main.c
+++ b/usr.bin/mail/main.c
@@ -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.
OpenPOWER on IntegriCloud