summaryrefslogtreecommitdiff
path: root/usr.bin/mail/main.c
diff options
context:
space:
mode:
authorMike Heffner <mikeh@FreeBSD.org>2001-05-27 20:26:22 +0000
committerMike Heffner <mikeh@FreeBSD.org>2001-05-27 20:26:22 +0000
commit9ce73e901878324070d0420a285d144d5acffe2d (patch)
tree4db24da36a30190b6f21e814d19598255620d0ed /usr.bin/mail/main.c
parent9dfe98e24e1729196d427ae6ea8ce8d0a9cfa081 (diff)
downloadsrc-test2-9ce73e901878324070d0420a285d144d5acffe2d.tar.gz
src-test2-9ce73e901878324070d0420a285d144d5acffe2d.zip
Notes
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 97617ee66947..633febcaf8a8 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);