version 1.4, 1997/01/15 23:42:50 |
version 1.5, 1997/07/13 21:21:15 |
|
|
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
/* $NetBSD: main.c,v 1.5 1996/06/08 19:48:31 christos Exp $ */ |
/* $NetBSD: main.c,v 1.7 1997/05/13 06:15:57 mikel Exp $ */ |
|
|
/* |
/* |
* Copyright (c) 1980, 1993 |
* Copyright (c) 1980, 1993 |
|
|
|
|
#ifndef lint |
#ifndef lint |
#if 0 |
#if 0 |
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; |
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/20/95"; |
#else |
#else |
static char rcsid[] = "$OpenBSD$"; |
static char rcsid[] = "$OpenBSD$"; |
#endif |
#endif |
|
|
char *ef; |
char *ef; |
char nosrc = 0; |
char nosrc = 0; |
sig_t prevint; |
sig_t prevint; |
|
char *rc; |
|
|
/* |
/* |
* Set up a reasonable environment. |
* Set up a reasonable environment. |
|
|
* articles have been read/deleted for netnews. |
* articles have been read/deleted for netnews. |
*/ |
*/ |
Tflag = optarg; |
Tflag = optarg; |
if ((i = creat(Tflag, 0600)) < 0) { |
if ((i = creat(Tflag, 0600)) < 0) |
perror(Tflag); |
err(1, Tflag); |
exit(1); |
(void)close(i); |
} |
|
close(i); |
|
break; |
break; |
case 'u': |
case 'u': |
/* |
/* |
|
|
bcc = cat(bcc, nalloc(optarg, GBCC)); |
bcc = cat(bcc, nalloc(optarg, GBCC)); |
break; |
break; |
case '?': |
case '?': |
fputs("\ |
fprintf(stderr, "\ |
Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\ |
Usage: %s [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\ |
[- sendmail-options ...]\n\ |
[- sendmail-options ...]\n\ |
mail [-iInNv] -f [name]\n\ |
%s [-iInNv] -f [name]\n\ |
mail [-iInNv] [-u user]\n", |
%s [-iInNv] [-u user]\n", __progname, __progname, __progname); |
stderr); |
|
exit(1); |
exit(1); |
} |
} |
} |
} |
|
|
/* |
/* |
* Check for inconsistent arguments. |
* Check for inconsistent arguments. |
*/ |
*/ |
if (to == NIL && (subject != NOSTR || cc != NIL || bcc != NIL)) { |
if (to == NIL && (subject != NOSTR || cc != NIL || bcc != NIL)) |
fputs("You must specify direct recipients with -s, -c, or -b.\n", stderr); |
errx(1, "You must specify direct recipients with -s, -c, or -b"); |
exit(1); |
if (ef != NOSTR && to != NIL) |
} |
errx(1, "Cannot give -f and people to send to"); |
if (ef != NOSTR && to != NIL) { |
|
fprintf(stderr, "Cannot give -f and people to send to.\n"); |
|
exit(1); |
|
} |
|
tinit(); |
tinit(); |
setscreensize(); |
setscreensize(); |
input = stdin; |
input = stdin; |
|
|
* Expand returns a savestr, but load only uses the file name |
* Expand returns a savestr, but load only uses the file name |
* for fopen, so it's safe to do this. |
* for fopen, so it's safe to do this. |
*/ |
*/ |
load(expand("~/.mailrc")); |
if ((rc = getenv("MAILRC")) == 0) |
|
rc = "~/.mailrc"; |
|
load(expand(rc)); |
if (!rcvmode) { |
if (!rcvmode) { |
mail(to, cc, bcc, smopts, subject); |
mail(to, cc, bcc, smopts, subject); |
/* |
/* |
|
|
{ |
{ |
|
|
fflush(stdout); |
fflush(stdout); |
fprintf(stderr, "\nInterrupt\n"); |
fputs("\nInterrupt\n", stderr); |
longjmp(hdrjmp, 1); |
longjmp(hdrjmp, 1); |
} |
} |
|
|