summaryrefslogtreecommitdiffstats
path: root/usr.bin/mail/main.c
diff options
context:
space:
mode:
authormikeh <mikeh@FreeBSD.org>2001-05-27 20:26:22 +0000
committermikeh <mikeh@FreeBSD.org>2001-05-27 20:26:22 +0000
commitaa40e2eac7ab213ab193707b4dec5e4bb0a8325b (patch)
tree35781af5ff6a267c8e45e7cc6091e7df70c229ce /usr.bin/mail/main.c
parent83f67b8f31f7864baf3998922833c641684ff0f0 (diff)
downloadFreeBSD-src-aa40e2eac7ab213ab193707b4dec5e4bb0a8325b.zip
FreeBSD-src-aa40e2eac7ab213ab193707b4dec5e4bb0a8325b.tar.gz
Cleanup mail(1)'s varying styles by converting to using style(9).
Also take a stab at cleaning up BDECFLAGS and convert all uses of NOSTR, NIL, NONE, NOVAR, NOGRP, NOGE to NULL. Also kill 'register' to get diffs somewhat closer to OpenBSD/NetBSD. There are no functional changes however. Reviewed by: nra (visual inspection)
Diffstat (limited to 'usr.bin/mail/main.c')
-rw-r--r--usr.bin/mail/main.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/usr.bin/mail/main.c b/usr.bin/mail/main.c
index 97617ee..633febc 100644
--- a/usr.bin/mail/main.c
+++ b/usr.bin/mail/main.c
@@ -57,26 +57,26 @@ static const char rcsid[] =
jmp_buf hdrjmp;
+extern const char *version;
+
int
main(argc, argv)
int argc;
char *argv[];
{
- register int i;
+ int i;
struct name *to, *cc, *bcc, *smopts;
char *subject, *replyto;
char *ef, *cp;
char nosrc = 0;
- void hdrstop();
sig_t prevint;
- void sigchild();
/*
* Set up a reasonable environment.
* Figure out whether we are being run interactively,
* start the SIGCHLD catcher, and so forth.
*/
- (void) signal(SIGCHLD, sigchild);
+ (void)signal(SIGCHLD, sigchild);
if (isatty(0))
assign("interactive", "");
image = -1;
@@ -87,13 +87,13 @@ main(argc, argv)
* of users to mail to. Argp will be set to point to the
* first of these users.
*/
- ef = NOSTR;
- to = NIL;
- cc = NIL;
- bcc = NIL;
- smopts = NIL;
- subject = NOSTR;
- replyto = NOSTR;
+ ef = NULL;
+ to = NULL;
+ cc = NULL;
+ bcc = NULL;
+ smopts = NULL;
+ subject = NULL;
+ replyto = NULL;
while ((i = getopt(argc, argv, "INT:b:c:dfins:u:v")) != -1) {
switch (i) {
case 'T':
@@ -103,16 +103,16 @@ main(argc, argv)
*/
Tflag = optarg;
if ((i = open(Tflag, O_CREAT | O_TRUNC | O_WRONLY,
- 0600)) < 0)
+ 0600)) < 0)
err(1, "%s", Tflag);
- close(i);
+ (void)close(i);
break;
case 'u':
/*
* Next argument is person to pretend to be.
*/
myname = optarg;
- unsetenv("MAIL");
+ unsetenv("MAIL");
break;
case 'i':
/*
@@ -141,7 +141,7 @@ main(argc, argv)
* getopt() can't handle optional arguments, so here
* is an ugly hack to get around it.
*/
- if ((argv[optind]) && (argv[optind][0] != '-'))
+ if ((argv[optind] != NULL) && (argv[optind][0] != '-'))
ef = argv[optind++];
else
ef = "&";
@@ -192,16 +192,16 @@ Usage: %s [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
exit(1);
}
}
- for (i = optind; (argv[i]) && (*argv[i] != '-'); i++)
+ for (i = optind; (argv[i] != NULL) && (*argv[i] != '-'); i++)
to = cat(to, nalloc(argv[i], GTO));
- for (; argv[i]; i++)
+ for (; argv[i] != NULL; i++)
smopts = cat(smopts, nalloc(argv[i], 0));
/*
* Check for inconsistent arguments.
*/
- if (to == NIL && (subject != NOSTR || cc != NIL || bcc != NIL))
+ if (to == NULL && (subject != NULL || cc != NULL || bcc != NULL))
errx(1, "You must specify direct recipients with -s, -c, or -b.");
- if (ef != NOSTR && to != NIL)
+ if (ef != NULL && to != NULL)
errx(1, "Cannot give -f and people to send to.");
tinit();
setscreensize();
@@ -239,26 +239,24 @@ Usage: %s [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
* Decide whether we are editing a mailbox or reading
* the system mailbox, and open up the right stuff.
*/
- if (ef == NOSTR)
+ if (ef == NULL)
ef = "%";
if (setfile(ef) < 0)
exit(1); /* error already reported */
if (setjmp(hdrjmp) == 0) {
- extern char *version;
-
if ((prevint = signal(SIGINT, SIG_IGN)) != SIG_IGN)
- signal(SIGINT, hdrstop);
- if (value("quiet") == NOSTR)
+ (void)signal(SIGINT, hdrstop);
+ if (value("quiet") == NULL)
printf("Mail version %s. Type ? for help.\n",
version);
announce();
- fflush(stdout);
- signal(SIGINT, prevint);
+ (void)fflush(stdout);
+ (void)signal(SIGINT, prevint);
}
commands();
- signal(SIGHUP, SIG_IGN);
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
+ (void)signal(SIGHUP, SIG_IGN);
+ (void)signal(SIGINT, SIG_IGN);
+ (void)signal(SIGQUIT, SIG_IGN);
quit();
exit(0);
}
@@ -266,12 +264,13 @@ Usage: %s [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
/*
* Interrupt printing of the headers.
*/
+/*ARGSUSED*/
void
hdrstop(signo)
int signo;
{
- fflush(stdout);
+ (void)fflush(stdout);
fprintf(stderr, "\nInterrupt\n");
longjmp(hdrjmp, 1);
}
@@ -291,7 +290,7 @@ setscreensize()
struct termios tio;
speed_t speed = 0;
- if (ioctl(1, TIOCGWINSZ, (char *) &ws) < 0)
+ if (ioctl(1, TIOCGWINSZ, (char *)&ws) < 0)
ws.ws_col = ws.ws_row = 0;
if (tcgetattr(1, &tio) != -1)
speed = cfgetospeed(&tio);
OpenPOWER on IntegriCloud