X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fcomp.c;h=f867593251fb3d2a1b5838d4f3c76a2b77c6c12b;hp=6508ba67a7508fccea72241ad9c3d311aaad1d8d;hb=fede6e42d81ce34fd5c1bbe7fb2757b281c2573a;hpb=a0b824f146a18ad99633addede9e81a470d4cb59 diff --git a/uip/comp.c b/uip/comp.c index 6508ba6..f867593 100644 --- a/uip/comp.c +++ b/uip/comp.c @@ -13,21 +13,17 @@ static struct swit switches[] = { #define EDITRSW 0 { "editor editor", 0 }, -#define NEDITSW 1 - { "noedit", 0 }, -#define FORMSW 2 +#define FORMSW 1 { "form formfile", 0 }, -#define USESW 3 +#define USESW 2 { "use", 0 }, -#define NUSESW 4 - { "nouse", 0 }, -#define WHATSW 5 +#define NUSESW 3 + { "nouse", 2 }, +#define WHATSW 4 { "whatnowproc program", 0 }, -#define NWHATSW 6 - { "nowhatnowproc", 0 }, -#define VERSIONSW 7 - { "version", 0 }, -#define HELPSW 8 +#define VERSIONSW 5 + { "Version", 0 }, +#define HELPSW 6 { "help", 0 }, { NULL, 0 } }; @@ -36,19 +32,16 @@ static struct swit switches[] = { int main(int argc, char **argv) { - int use = NOUSE, nedit = 0, nwhat = 0; + int use = NOUSE; int in, out; char *cp, *cwd, *maildir; char *ed = NULL, *form = NULL; char *folder = NULL, *msg = NULL, buf[BUFSIZ]; char drft[BUFSIZ], **argp, **arguments; struct msgs *mp = NULL; - char *nfs; + char *fmtstr; - -#ifdef LOCALE setlocale(LC_ALL, ""); -#endif invo_name = mhbasename(argv[0]); /* read user profile/context */ @@ -62,34 +55,27 @@ main(int argc, char **argv) switch (smatch(++cp, switches)) { case AMBIGSW: ambigsw(cp, switches); - done(1); + /* sysexits.h EX_USAGE */ + exit(1); case UNKWNSW: adios(NULL, "-%s unknown", cp); case HELPSW: snprintf(buf, sizeof(buf), "%s [+folder] [msg] [switches]", invo_name); print_help(buf, switches, 1); - done(1); + exit(0); case VERSIONSW: print_version(invo_name); - done(1); + exit(0); case EDITRSW: if (!(ed = *argp++) || *ed == '-') adios(NULL, "missing argument to %s", argp[-2]); - nedit = 0; - continue; - case NEDITSW: - nedit++; continue; case WHATSW: if (!(whatnowproc = *argp++) || *whatnowproc == '-') adios(NULL, "missing argument to %s", argp[-2]); - nwhat = 0; - continue; - case NWHATSW: - nwhat++; continue; case FORMSW: @@ -147,7 +133,8 @@ main(int argc, char **argv) adios(NULL, "no messages in %s", folder); /* parse the message range/sequence/name and set SELECTED */ if (!m_convert(mp, msg)) - done(1); + /* sysexits.h EX_USAGE */ + exit(1); seq_setprev(mp); /* set the previous-sequence */ if (mp->numsel > 1) adios(NULL, "only one message at a time!"); @@ -164,23 +151,19 @@ main(int argc, char **argv) close(out); } else { - nfs = new_fs(form, NULL, components, NULL); + fmtstr = new_fs(form, components); strncpy(drft, m_draft(seq_beyond), sizeof(drft)); if ((out = creat(drft, m_gmprot())) == NOTOK) { adios(drft, "unable to create"); } - if (write(out, nfs, strlen(nfs)) != strlen(nfs)) { + if (write(out, fmtstr, strlen(fmtstr)) != (int)strlen(fmtstr)) { adios(drft, "error writing"); } close(out); } context_save(); - - if (nwhat) { - done(0); - } - what_now(ed, nedit, use, drft, NULL, 0, NULLMP, NULL, cwd); - done(1); + what_now(ed, use, drft, NULL, 0, NULLMP, NULL, cwd); + /* sysexits.h EX_SOFTWARE */ return 1; }