X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fwhatnow.c;h=be046ac79f632fadc3dfb6838abab206988ed4c7;hp=7e54929ff444196c848d98ca3b0d8674d27758bc;hb=ee8d01d64e8832304256de53db07228e2be67f6a;hpb=cf1205b5cbea2f0cd6ea710ec16c637df85b647c diff --git a/uip/whatnow.c b/uip/whatnow.c index 7e54929..be046ac 100644 --- a/uip/whatnow.c +++ b/uip/whatnow.c @@ -32,6 +32,8 @@ static struct swit switches[] = { { NULL, 0 } }; +char *version=VERSION; + /* ** Options at the "whatnow" prompt */ @@ -72,7 +74,7 @@ static char *myprompt = "\nWhat now? "; /* ** static prototypes */ -static int editfile(char **, char **, char *, int); +static int editfile(char **, char **, char *); static int sendfile(char **, char *); static int refile(char **, char *); static int removefile(char *); @@ -85,7 +87,7 @@ static int system_in_dir(const char *, const char *); int main(int argc, char **argv) { - int use = 0; + int use = NOUSE; char *cp; char *ed = NULL, *drft = NULL; char buf[BUFSIZ], prompt[BUFSIZ]; @@ -153,7 +155,7 @@ main(int argc, char **argv) } if ((!drft && !(drft = getenv("mhdraft"))) || !*drft) - drft = getcpy(m_draft(seq_cur)); + drft = mh_xstrdup(m_draft(seq_cur)); if ((cp = getenv("mhuse")) && *cp) use = atoi(cp); @@ -164,7 +166,7 @@ main(int argc, char **argv) /* start editing the draft, unless editor is the empty string */ if (*ed) { - if (editfile(&ed, NULL, drft, use) <0) { + if (editfile(&ed, NULL, drft) <0) { if (!use) { unlink(drft); } @@ -173,10 +175,7 @@ main(int argc, char **argv) } snprintf(prompt, sizeof(prompt), myprompt, invo_name); - for (;;) { - if (!(argp = getans(prompt, aleqs))) { - exit(EX_IOERR); - } + while ((argp = getans(prompt, aleqs))) { switch (smatch(*argp, aleqs)) { case DISPSW: /* display the msg being replied to or distributed */ @@ -192,7 +191,7 @@ main(int argc, char **argv) /* Call an editor on the draft file */ if (*++argp) ed = *argp++; - editfile(&ed, argp, drft, NOUSE); + editfile(&ed, argp, drft); break; case LISTSW: @@ -381,7 +380,8 @@ main(int argc, char **argv) break; } } - /*NOTREACHED*/ + + exit(EX_IOERR); } @@ -489,7 +489,7 @@ static char *edsave = NULL; /* the editor we used previously */ static int -editfile(char **ed, char **arg, char *file, int use) +editfile(char **ed, char **arg, char *file) { int pid, status, vecp; char *cp, *vec[MAXARGS]; @@ -557,7 +557,7 @@ editfile(char **ed, char **arg, char *file, int use) } /* remember which editor we used */ - edsave = getcpy(*ed); + edsave = mh_xstrdup(*ed); *ed = NULL;