From 0b3c8268698a53b79a31d65838c73a059d803461 Mon Sep 17 00:00:00 2001 From: "Kurt A. Schoens" Date: Thu, 9 Oct 1980 21:39:52 -0800 Subject: [PATCH] changed to call setfile/lex.c to set up initial input file. SCCS-vsn: usr.bin/mail/main.c 1.2 --- usr/src/usr.bin/mail/main.c | 51 +++---------------------------------- 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/usr/src/usr.bin/mail/main.c b/usr/src/usr.bin/mail/main.c index c71723f59f..6d2b46aa14 100644 --- a/usr/src/usr.bin/mail/main.c +++ b/usr/src/usr.bin/mail/main.c @@ -9,7 +9,7 @@ * Startup -- interface with user. */ -static char *SccsId = "@(#)main.c 1.1 %G%"; +static char *SccsId = "@(#)main.c 1.2 %G%"; /* * Find out who the user is, copy his mail file (if exists) into @@ -29,7 +29,7 @@ main(argc, argv) register int i, argp; int mustsend, uflag; FILE *ibuf, *ftat; - extern char tempMesg[], _sobuf[]; + extern char _sobuf[]; #ifdef signal Siginit(); @@ -217,54 +217,9 @@ main(argc, argv) if (ef != NOSTR) { edit++; editfile = mailname = ef; - if ((ibuf = fopen(mailname, "r")) == NULL) { - perror(mailname); - exit(1); - } - if ((i = open(mailname, 1)) < 0) - printf("Warning: \"%s\" not writable.\n", mailname); - else - close(i); - } - else { - if ((ibuf = fopen(mailname, "r")) == NULL) { - if (uflag) - printf("No mail for %s\n", myname); - else - printf("No mail.\n"); - exit(0); - } - } - - /* - * Copy the messages into /tmp - * and set pointers. - */ - - mailsize = fsize(ibuf); - if ((otf = fopen(tempMesg, "w")) == NULL) { - perror(tempMesg); - exit(1); } - if ((itf = fopen(tempMesg, "r")) == NULL) { - perror(tempMesg); + if (setfile(mailname, edit) < 0) exit(1); - } - remove(tempMesg); - setptr(ibuf); - fclose(ibuf); - - /* - * print headings and accept user commands. - */ - - if (msgCount == 0) { - if (uflag) - printf("No mail for %s\n", myname); - else - printf("No messages.\n"); - exit(1); - } commands(); if (!edit) quit(); -- 2.20.1