summaryrefslogtreecommitdiffstats
path: root/usr.bin/mail/main.c
diff options
context:
space:
mode:
authormikeh <mikeh@FreeBSD.org>2004-02-29 20:44:44 +0000
committermikeh <mikeh@FreeBSD.org>2004-02-29 20:44:44 +0000
commit9d29f488fff50b2f5e4eb49f972fb3d0e3522029 (patch)
tree504aca9a1fd911180e61a965ba10728d59f52cbd /usr.bin/mail/main.c
parent1631601f6d0b62bdd426c167f3a29cb48a797bbf (diff)
downloadFreeBSD-src-9d29f488fff50b2f5e4eb49f972fb3d0e3522029.zip
FreeBSD-src-9d29f488fff50b2f5e4eb49f972fb3d0e3522029.tar.gz
Add the -e (mail presence test), -H (header summary mode), and -F
(message save as first recipient) options for standards conformance. Submitted by: Wartan Hachaturow <wart@tepkom.ru> (with some changes) PR: standards/61934
Diffstat (limited to 'usr.bin/mail/main.c')
-rw-r--r--usr.bin/mail/main.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/usr.bin/mail/main.c b/usr.bin/mail/main.c
index c4d0704..4a00177 100644
--- a/usr.bin/mail/main.c
+++ b/usr.bin/mail/main.c
@@ -93,7 +93,7 @@ main(argc, argv)
bcc = NULL;
smopts = NULL;
subject = NULL;
- while ((i = getopt(argc, argv, "EINT:b:c:dfins:u:v")) != -1) {
+ while ((i = getopt(argc, argv, "FEHINT:b:c:edfins:u:v")) != -1) {
switch (i) {
case 'T':
/*
@@ -123,6 +123,25 @@ main(argc, argv)
case 'd':
debug++;
break;
+ case 'e':
+ /*
+ * User wants to check mail and exit.
+ */
+ assign("checkmode", "");
+ break;
+ case 'H':
+ /*
+ * User wants a header summary only.
+ */
+ assign("headersummary", "");
+ break;
+ case 'F':
+ /*
+ * User wants to record messages to files
+ * named after first recipient username.
+ */
+ assign("recordrecip", "");
+ break;
case 's':
/*
* Give a subject field for sending from
@@ -189,11 +208,13 @@ main(argc, argv)
break;
case '?':
fprintf(stderr, "\
-Usage: %s [-EiInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
+Usage: %s [-EiInv] [-s subject] [-c cc-addr] [-b bcc-addr] [-F] to-addr ...\n\
%*s [- sendmail-options ...]\n\
- %s [-EiInNv] -f [name]\n\
- %s [-EiInNv] [-u user]\n",__progname, strlen(__progname), "",
- __progname, __progname);
+ %s [-EHiInNv] [-F] -f [name]\n\
+ %s [-EHiInNv] [-F] [-u user]\n\
+ %s -e [-f name]\n\
+ %s -H\n",__progname, strlen(__progname), "",
+ __progname, __progname, __progname, __progname);
exit(1);
}
}
@@ -240,6 +261,18 @@ Usage: %s [-EiInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
*/
exit(senderr);
}
+
+ if(value("checkmode") != NULL) {
+ if (ef == NULL)
+ ef = "%";
+ if (setfile(ef) <= 0)
+ /* Either an error has occured, or no mail */
+ exit(1);
+ else
+ exit(0);
+ /* NOTREACHED */
+ }
+
/*
* Ok, we are reading mail.
* Decide whether we are editing a mailbox or reading
@@ -259,6 +292,11 @@ Usage: %s [-EiInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
(void)fflush(stdout);
(void)signal(SIGINT, prevint);
}
+
+ /* If we were in header summary mode, it's time to exit. */
+ if (value("headersummary") != NULL)
+ exit(0);
+
commands();
(void)signal(SIGHUP, SIG_IGN);
(void)signal(SIGINT, SIG_IGN);
OpenPOWER on IntegriCloud