from -f so we can interpret +name. Header printing now invoked by
main() with special escape to be able to ^C it.
SCCS-vsn: usr.bin/mail/main.c 2.5
* Startup -- interface with user.
*/
* Startup -- interface with user.
*/
-static char *SccsId = "@(#)main.c 2.4 %G%";
+static char *SccsId = "@(#)main.c 2.5 %G%";
+
+jmp_buf hdrjmp;
/*
* Find out who the user is, copy his mail file (if exists) into
/*
* Find out who the user is, copy his mail file (if exists) into
{
register char *ef;
register int i, argp;
{
register char *ef;
register int i, argp;
+ int mustsend, uflag, hdrstop(), (*prevint)();
FILE *ibuf, *ftat;
extern char _sobuf[];
struct sgttyb tbuf;
FILE *ibuf, *ftat;
extern char _sobuf[];
struct sgttyb tbuf;
*/
uflag++;
if (i >= argc - 1) {
*/
uflag++;
if (i >= argc - 1) {
- fprintf(stderr, "You obviously dont know what you're doing\n");
+ fprintf(stderr, "Missing user name for -u\n");
exit(1);
}
strcpy(myname, argv[i+1]);
exit(1);
}
strcpy(myname, argv[i+1]);
* Check for inconsistent arguments.
*/
* Check for inconsistent arguments.
*/
- if (rflag != NOSTR && strcmp(rflag, "daemon") == 0) {
- ftat = fopen("/crp/kas/gotcha", "a");
- if (ftat != NULL) {
- fprintf(ftat, "user daemon, real uid %d\n", getuid());
- fclose(ftat);
- }
- }
if (ef != NOSTR && argp != -1) {
fprintf(stderr, "Cannot give -f and people to send to.\n");
exit(1);
if (ef != NOSTR && argp != -1) {
fprintf(stderr, "Cannot give -f and people to send to.\n");
exit(1);
+ input = stdin;
+ rcvmode = argp == -1;
+ if (!nosrc)
+ load(MASTER);
+ load(mailrc);
* the system mailbox, and open up the right stuff.
*/
* the system mailbox, and open up the right stuff.
*/
+ ename = expand(ef);
+ if (ename != ef) {
+ ef = (char *) calloc(1, strlen(ename) + 1);
+ strcpy(ef, ename);
+ }
editfile = mailname = ef;
}
if (setfile(mailname, edit) < 0)
exit(1);
editfile = mailname = ef;
}
if (setfile(mailname, edit) < 0)
exit(1);
+ if (!edit && !noheader && value("noheader") == NOSTR) {
+ if (setjmp(hdrjmp) == 0) {
+ if ((prevint = sigset(SIGINT, SIG_IGN)) != SIG_IGN)
+ sigset(SIGINT, hdrstop);
+ announce();
+ fflush(stdout);
+ sigset(SIGINT, prevint);
+ }
+ }
+ if (edit)
+ newfileinfo();
if (!edit && msgCount == 0) {
printf("No mail\n");
fflush(stdout);
if (!edit && msgCount == 0) {
printf("No mail\n");
fflush(stdout);
+
+/*
+ * Interrupt printing of the headers.
+ */
+hdrstop()
+{
+
+ clrbuf(stdout);
+ printf("\nInterrupt\n");
+ fflush(stdout);
+ sigrelse(SIGINT);
+ longjmp(hdrjmp, 1);
+}