]> git.marmaro.de Git - mmh/commitdiff
Replace done with exit at uip
authorPhilipp Takacs <philipp@bureaucracy.de>
Sun, 14 Dec 2014 13:45:35 +0000 (14:45 +0100)
committerPhilipp Takacs <philipp@bureaucracy.de>
Fri, 16 Jan 2015 18:18:08 +0000 (19:18 +0100)
Replace done with exit in most sourcefiles of uip. This makes the
code better to read. If the done was overwritten by an externel function
atexit() is used instand.

send.c and mhl.c are excluded, because need a bit rewrite first.

40 files changed:
uip/ali.c
uip/anno.c
uip/ap.c
uip/burst.c
uip/comp.c
uip/dist.c
uip/dp.c
uip/flist.c
uip/fmtdump.c
uip/folder.c
uip/forw.c
uip/inc.c
uip/mark.c
uip/mhbuild.c
uip/mhfree.c
uip/mhlist.c
uip/mhmail.c
uip/mhparam.c
uip/mhparse.c
uip/mhpath.c
uip/mhshow.c
uip/mhstore.c
uip/mhtest.c
uip/new.c
uip/packf.c
uip/pick.c
uip/prompter.c
uip/rcvdist.c
uip/rcvpack.c
uip/rcvstore.c
uip/refile.c
uip/repl.c
uip/rmf.c
uip/rmm.c
uip/scan.c
uip/slocal.c
uip/sortm.c
uip/spost.c
uip/whatnow.c
uip/whom.c

index 2c80147e5e49021312e8a32b5fea3d0ba0a2a2c0..4d7617bff7802022721c0569e5ded3118b6854b9 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -72,7 +72,8 @@ 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);
 
@@ -80,10 +81,10 @@ main(int argc, char **argv)
                                snprintf(buf, sizeof(buf), "%s [switches] aliases ...",
                                        invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case FILESW:
                                if (!(cp = *argp++) || *cp == '-')
@@ -145,7 +146,7 @@ main(int argc, char **argv)
                for (i = 0; i < vecp; i++)
                        print_usr(vec[i], list, normalize);
 
-               done(0);
+               exit(0);
        }
 
        if (vecp) {
@@ -161,8 +162,7 @@ main(int argc, char **argv)
                }
        }
 
-       done(0);
-       return 1;
+       return 0;
 }
 
 static void
index e8742385fa2475c1f704de538145c116e3627c3f..0483dffc201510935e70116ab12459aea5cfda30 100644 (file)
@@ -86,7 +86,8 @@ 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);
 
@@ -95,10 +96,10 @@ main(int argc, char **argv)
                                        "%s [+folder] [msgs] [switches]",
                                        invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case DELETESW:  /* delete annotations */
                                mode = MODE_DEL;
@@ -202,7 +203,7 @@ main(int argc, char **argv)
                else
                        annotate(file, comp, text, datesw, number,
                                        append, preserve);
-               done(0);
+               exit(0);
        }
 
        if (!msgs.size)
@@ -223,9 +224,12 @@ main(int argc, char **argv)
                adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
-       for (msgnum = 0; msgnum < msgs.size; msgnum++)
-               if (!m_convert(mp, msgs.msgs[msgnum]))
-                       done(1);
+       for (msgnum = 0; msgnum < msgs.size; msgnum++) {
+               if (!m_convert(mp, msgs.msgs[msgnum])) {
+                       /* sysexits.h EX_USAGE */
+                       exit(1);
+               }
+       }
 
        /* annotate all the SELECTED messages */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
@@ -243,8 +247,7 @@ main(int argc, char **argv)
        seq_save(mp);
        folder_free(mp);
        context_save();
-       done(0);
-       return 1;
+       return 0;
 }
 
 static void
@@ -258,7 +261,8 @@ make_comp(unsigned char **ap)
                fflush(stdout);
 
                if (!fgets(buffer, sizeof buffer, stdin)) {
-                       done(1);
+                       /* sysexits.h EX_IOERR */
+                       exit(1);
                }
                *ap = trimcpy(buffer);
        }
index c293a5325b794048a0941888e6807b87977ce1d6..41554d7ed14c231fb25f2c4ca8327ab9c0d18e37 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -61,7 +61,8 @@ 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);
@@ -69,10 +70,10 @@ main(int argc, char **argv)
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [switches] addrs ...", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case FORMSW:
                                if (!(form = *argp++) || *form == '-')
@@ -112,7 +113,7 @@ main(int argc, char **argv)
        for (addrp = 0; addrs[addrp]; addrp++)
                status += process(addrs[addrp], normalize);
 
-       done(status);
+       exit(status);
        return 1;
 }
 
index e657c33fa5fc1cf282c3fd9a8e3e59da431cc7a9..db2ddc68871e36ecce091400d37789028fc31e6d 100644 (file)
@@ -59,17 +59,18 @@ 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\n", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case VERBSW:
                                verbosw++;
@@ -109,7 +110,8 @@ main(int argc, char **argv)
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgp; msgnum++)
                if (!m_convert(mp, msgs[msgnum]))
-                       done(1);
+                       /* sysexits.h EX_USAGE */
+                       exit(1);
        seq_setprev(mp);  /* set the previous-sequence */
 
        smsgs = (struct smsg *)
@@ -148,8 +150,7 @@ main(int argc, char **argv)
        seq_save(mp);
        context_save();
        folder_free(mp);
-       done(0);
-       return 1;
+       return 0;
 }
 
 
index 4768fc4a3d1281a48f93f65ddfb45e32bad9c547..f867593251fb3d2a1b5838d4f3c76a2b77c6c12b 100644 (file)
@@ -55,17 +55,18 @@ 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 == '-')
@@ -132,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!");
@@ -162,6 +164,6 @@ main(int argc, char **argv)
 
        context_save();
        what_now(ed, use, drft, NULL, 0, NULLMP, NULL, cwd);
-       done(1);
+       /* sysexits.h EX_SOFTWARE */
        return 1;
 }
index c1f4f9d3cb86b621a42d5897d4d1555c7f854c9b..47d7ed507fe6e21090c865996052a523769d67d0 100644 (file)
@@ -55,17 +55,18 @@ 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 ANNOSW:
                                anot++;
@@ -136,7 +137,8 @@ main(int argc, char **argv)
 
        /* 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);
 
        if (mp->numsel > 1)
@@ -152,6 +154,6 @@ main(int argc, char **argv)
        context_save();
 
        what_now(ed, NOUSE, drft, msgnam, 1, mp, anot ? "Resent" : NULL, cwd);
-       done(1);
+       /*sysexits.h EX_SOFTWARE*/
        return 1;
 }
index 1a91678f402d5afc2f0ae9a173dfa0c13e757065..22e725c30cfb0c2a4515c0edc837d5fd16883311 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
@@ -56,17 +56,18 @@ 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 [switches] dates ...", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case FORMSW:
                                if (!(form = *argp++) || *form == '-')
@@ -101,8 +102,7 @@ main(int argc, char **argv)
                status += process(dates[datep]);
 
        context_save();  /* save the context file */
-       done(status);
-       return 1;
+       return status;
 }
 
 
index 057d5f4eceffe4d317ce3400e8721e27285d3540..c0c8b5f63c4c4443cb34354158cc9f369080c90f 100644 (file)
@@ -149,17 +149,18 @@ 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 [+folder1 [+folder2 ...]][switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case SEQSW:
                                if (!(cp = *argp++) || *cp == '-')
@@ -260,8 +261,7 @@ main(int argc, char **argv)
        qsort(folders, nFolders, sizeof(struct Folder),
                        (qsort_comp) CompareFolders);
        PrintFolders();
-       done(0);
-       return 1;
+       return 0;
 }
 
 /*
index a0e6e1409c35f1a4849fa8d190b94f1799354a8a..dd5dbcb1e38a219f650e2a5412796544505ead1a 100644 (file)
@@ -60,7 +60,8 @@ 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);
 
@@ -68,10 +69,10 @@ main(int argc, char **argv)
                                snprintf(buf, sizeof(buf), "%s [switches]",
                                                invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case FORMSW:
                                if (!(form = *argp++) || *form == '-')
@@ -94,8 +95,7 @@ main(int argc, char **argv)
        fmt_compile(fmtstr, &fmt);
 
        fmt_dump(fmt);
-       done(0);
-       return 1;
+       return 0;
 }
 
 static void
index 8638151edcb985aa3230e90d8421d47aeb8d139d..92ee49624e18849800b1dfe324860bdba807c6aa 100644 (file)
@@ -136,17 +136,18 @@ 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 ALLSW:
                                all = 1;
@@ -314,8 +315,9 @@ main(int argc, char **argv)
                }
                printf("\n");
 
-               if (!printsw)
-                       done(0);
+               if (!printsw) {
+                       exit(0);
+               }
        }
 
        /* Allocate initial space to record folder information */
@@ -379,8 +381,7 @@ main(int argc, char **argv)
        print_folders();
 
        context_save();
-       done(0);
-       return 1;
+       return 0;
 }
 
 static int
@@ -422,8 +423,9 @@ get_folder_info_body(char *fold, char *msg, boolean *crawl_children)
                        retval = 0;
 
                if (fpack) {
-                       if (folder_pack(&mp, fverb) == -1)
-                               done(1);
+                       if (folder_pack(&mp, fverb) == -1) {
+                               exit(0);
+                       }
                        seq_save(mp);  /* synchronize the sequences */
                        context_save();  /* save the context file */
                }
index 57e508f026096be7756354fa6b39198523107007..1ba80eed549c81086e999202a85a4ebe53b2dd89 100644 (file)
@@ -82,17 +82,18 @@ 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] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case ANNOSW:
                                anot++;
@@ -189,9 +190,12 @@ main(int argc, char **argv)
                adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
-       for (msgnum = 0; msgnum < msgp; msgnum++)
-               if (!m_convert(mp, msgs[msgnum]))
-                       done(1);
+       for (msgnum = 0; msgnum < msgp; msgnum++) {
+               if (!m_convert(mp, msgs[msgnum])) {
+                       /* sysexits.h EX_USAGE */
+                       exit(1);
+               }
+       }
        seq_setprev(mp);  /* set the previous sequence */
 
        if ((out = creat(drft, m_gmprot())) == NOTOK)
@@ -242,10 +246,10 @@ main(int argc, char **argv)
        context_save();  /* save the context file */
 
        if (buildsw)
-               done(0);
+               exit(0);
        what_now(ed, NOUSE, drft, NULL, 0, mp,
                anot ? "Forwarded" : NULL, cwd);
-       done(1);
+       /* sysexits.h EX_SOFTWARE */
        return 1;
 }
 
index f737d698bf48ec8eb5484ef63a52ef81203fc372..159e0108d112d7bd3b1e0a1acb5fbcf51cb5af85 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -119,7 +119,7 @@ static FILE *in;
 /*
 ** prototypes
 */
-static void inc_done(int) NORETURN;
+static void inc_done();
 
 
 int
@@ -143,7 +143,7 @@ main(int argc, char **argv)
        /* copy of mail directory because the static gets overwritten */
        char *maildir_copy = NULL;
 
-       done=inc_done;
+       atexit(inc_done);
 
 /*
 ** absolutely the first thing we do is save our privileges,
@@ -166,17 +166,18 @@ 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] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case AUDSW:
                                if (!(cp = *argp++) || *cp == '-')
@@ -480,17 +481,15 @@ main(int argc, char **argv)
        seq_setunseen(mp, 1);  /* add new msgs to unseen sequences */
        seq_save(mp);  /* synchronize sequences   */
        context_save();  /* save the context file   */
-       done(0);
-       return 1;
+       return 0;
 }
 
 static void
-inc_done(int status)
+inc_done()
 {
        if (locked) {
                GETGROUPPRIVS();
                lkfclose(in, newmail);
                DROPGROUPPRIVS();
        }
-       exit(status);
 }
index d4a3729ecdbdeea65941b385d05e5e3a39bd3dae..e58ec64d83f86ea3bce998d5e78c2fa8c1cad9ee 100644 (file)
@@ -73,17 +73,18 @@ 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\n", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case ADDSW:
                                addsw++;
@@ -171,9 +172,12 @@ main(int argc, char **argv)
                adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
-       for (msgnum = 0; msgnum < msgs.size; msgnum++)
-               if (!m_convert(mp, msgs.msgs[msgnum]))
-                       done(1);
+       for (msgnum = 0; msgnum < msgs.size; msgnum++) {
+               if (!m_convert(mp, msgs.msgs[msgnum])) {
+                       /*sysexits.h EX_USAGE*/
+                       exit(1);
+               }
+       }
 
        if (publicsw == 1 && is_readonly(mp))
                adios(NULL, "folder %s is read-only, so -public not allowed",
@@ -190,16 +194,20 @@ main(int argc, char **argv)
 
        /* Adding messages to sequences */
        if (addsw) {
-               for (seqp = 0; seqs[seqp]; seqp++)
-                       if (!seq_addsel(mp, seqs[seqp], publicsw, zerosw))
-                               done(1);
+               for (seqp = 0; seqs[seqp]; seqp++) {
+                       if (!seq_addsel(mp, seqs[seqp], publicsw, zerosw)) {
+                               /*TODO find best exitcode*/
+                               exit(1);
+                       }
+               }
        }
 
        /* Deleting messages from sequences */
        if (deletesw) {
                for (seqp = 0; seqs[seqp]; seqp++)
                        if (!seq_delsel(mp, seqs[seqp], publicsw, zerosw))
-                               done(1);
+                               /*TODO find best exitcode*/
+                               exit(1);
        }
 
        /* Listing messages in sequences */
@@ -222,8 +230,7 @@ main(int argc, char **argv)
        context_replace(curfolder, folder);  /* update current folder */
        context_save();  /* save the context file */
        folder_free(mp);  /* free folder/message structure */
-       done(0);
-       return 1;
+       return 0;
 }
 
 
index fde4a1d784fd1d3cd3a6c017d828c4c741480be6..6e0861eafbe431c172475ff70f05e4cd25368299 100644 (file)
@@ -92,7 +92,7 @@ static int unlink_infile  = 0;
 static char outfile[BUFSIZ];
 static int unlink_outfile = 0;
 
-static void unlink_done(int) NORETURN;
+static void unlink_done();
 
 /* mhoutsbr.c */
 int output_message(CT, char *);
@@ -115,7 +115,7 @@ main(int argc, char **argv)
        FILE *fp = NULL;
        FILE *fp_out = NULL;
 
-       done = unlink_done;
+       atexit(unlink_done);
 
        setlocale(LC_ALL, "");
        invo_name = mhbasename(argv[0]);
@@ -139,17 +139,18 @@ 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 [switches] file", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case VERBSW:
                                verbosw++;
@@ -244,7 +245,7 @@ main(int argc, char **argv)
                unlink_outfile = 0;
 
                free_content(ct);
-               done(0);
+               exit(0);
        }
 
        /*
@@ -273,28 +274,28 @@ main(int argc, char **argv)
        if (rename(outfile, compfile) == NOTOK) {
                advise(compfile, "unable to rename output %s to", outfile);
                rename(buffer, compfile);
-               done(1);
+               /* sysexits.h EX_IOERR */
+               exit(1);
        }
        unlink_outfile = 0;
 
        free_content(ct);
-       done(0);
-       return 1;
+       return 0;
 }
 
 
 static void
-unlink_done(int status)
+unlink_done()
 {
        /*
        ** Check if we need to remove stray temporary files.
        */
-       if (unlink_infile)
+       if (unlink_infile) {
                unlink(infile);
-       if (unlink_outfile)
+       }
+       if (unlink_outfile) {
                unlink(outfile);
-
-       exit(status);
+       }
 }
 
 /*
@@ -419,8 +420,10 @@ finish_field:
        ** draft.  So create a multipart/mixed content to hold everything.
        ** We can remove this later, if it is not needed.
        */
-       if (get_ctinfo("multipart/mixed", ct, 0) == NOTOK)
-               done(1);
+       if (get_ctinfo("multipart/mixed", ct, 0) == NOTOK) {
+               /* sysexits.h EX_DATAERR */
+               exit(1);
+       }
        ct->c_type = CT_MULTIPART;
        ct->c_subtype = MULTI_MIXED;
        ct->c_file = getcpy(infile);
@@ -707,7 +710,8 @@ rock_and_roll:
 
                /* parse content type */
                if (get_ctinfo(content, ct, inlineD) == NOTOK)
-                       done(1);
+                       /* sysexits.h EX_USAGE */
+                       exit(1);
 
                for (s2i = str2cts; s2i->si_key; s2i++)
                        if (!mh_strcasecmp(ci->ci_type, s2i->si_key))
@@ -755,7 +759,8 @@ call_init:
 
        /* parse directive */
        if (get_ctinfo(buf+1, ct, 1) == NOTOK)
-               done(1);
+               /* sysexits.h EX_DATAERR */
+               exit(1);
 
        /* check directive against the list of MIME types */
        for (s2i = str2cts; s2i->si_key; s2i++)
@@ -826,7 +831,8 @@ use_forw:
                        if ((cp = context_find(buffer)) == NULL ||
                                        *cp == '\0') {
                                content_error(NULL, ct, "don't know how to compose content");
-                               done(1);
+                               /* sysexits.h EX_USAGE */
+                               exit(1);
                        }
                }
                ci->ci_magic = getcpy(cp);
@@ -878,7 +884,8 @@ use_forw:
                        cp = *ap;
                        if (*cp != '+' && *cp != '@')
                                if (!m_convert(mp, cp))
-                                       done(1);
+                                       /* sysexits.h EX_USAGE */
+                                       exit(1);
                }
                free(folder);
                free_ctinfo(ct);
@@ -892,7 +899,8 @@ use_forw:
                if (mp->numsel > 1) {
                        /* we are forwarding multiple messages */
                        if (get_ctinfo("multipart/digest", ct, 0) == NOTOK)
-                               done(1);
+                               /* sysexits.h EX_DATAERR */
+                               exit(1);
                        ct->c_type = CT_MULTIPART;
                        ct->c_subtype = MULTI_DIGEST;
 
@@ -915,7 +923,8 @@ use_forw:
                                        pe = p->c_cefile;
                                        if (get_ctinfo("message/rfc822", p, 0)
                                                        == NOTOK)
-                                               done(1);
+                                               /* sysexits.h EX_DATAERR */
+                                               exit(1);
                                        p->c_type = CT_MESSAGE;
                                        p->c_subtype = MESSAGE_RFC822;
 
@@ -934,7 +943,8 @@ use_forw:
                } else {
                        /* we are forwarding one message */
                        if (get_ctinfo("message/rfc822", ct, 0) == NOTOK)
-                               done(1);
+                               /* sysexits.h EX_DATAERR */
+                               exit(1);
                        ct->c_type = CT_MESSAGE;
                        ct->c_subtype = MESSAGE_RFC822;
 
@@ -980,7 +990,8 @@ use_forw:
                free_ctinfo(ct);
                snprintf(buffer, sizeof(buffer), "multipart/%s", cp);
                if (get_ctinfo(buffer, ct, 0) == NOTOK)
-                       done(1);
+                       /* sysexits.h EX_DATAERR */
+                       exit(1);
                ct->c_type = CT_MULTIPART;
                ct->c_subtype = vrsn;
 
@@ -1211,7 +1222,8 @@ raw:
                        default:
                                fclose(out);
                                if (pidXwait(child_id, NULL))
-                                       done(1);
+                                       /* sysexits.h EX_SOFTWARE */
+                                       exit(1);
                                break;
                        }
                }
index bf3382c5e4e5334c16d5a6b093666244d5d8e26e..c9a0418813b90a034ce19f16d5a5139886c535b4 100644 (file)
@@ -22,7 +22,7 @@ void free_content(CT);
 void free_header(CT);
 void free_ctinfo(CT);
 void free_encoding(CT, int);
-void freects_done(int);
+void freects_done();
 
 /*
 ** static prototypes
@@ -261,13 +261,13 @@ free_encoding(CT ct, int toplevel)
 
 
 void
-freects_done(int status)
+freects_done()
 {
        CT *ctp;
 
-       if ((ctp = cts))
-               for (; *ctp; ctp++)
+       if ((ctp = cts)) {
+               for (; *ctp; ctp++){
                        free_content(*ctp);
-
-       exit(status);
+               }
+       }
 }
index c66b7cfe6d7ceea96eb674fc95e75da0d62bc28d..8c7e51d2cc0075af7c63d5fa659b8cc346b104ec 100644 (file)
@@ -73,7 +73,7 @@ void list_all_messages(CT *, int, int);
 /* mhfree.c */
 void free_content(CT);
 extern CT *cts;
-void freects_done(int) NORETURN;
+void freects_done();
 
 /*
 ** static prototypes
@@ -92,7 +92,7 @@ main(int argc, char **argv)
        struct msgs *mp = NULL;
        CT ct, *ctp;
 
-       done=freects_done;
+       atexit(freects_done);
 
        setlocale(LC_ALL, "");
        invo_name = mhbasename(argv[0]);
@@ -111,17 +111,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case PARTSW:
                                if (!(cp = *argp++) || *cp == '-')
@@ -219,9 +219,12 @@ main(int argc, char **argv)
                        adios(NULL, "no messages in %s", folder);
 
                /* parse all the message ranges/sequences and set SELECTED */
-               for (msgnum = 0; msgnum < msgs.size; msgnum++)
-                       if (!m_convert(mp, msgs.msgs[msgnum]))
-                               done (1);
+               for (msgnum = 0; msgnum < msgs.size; msgnum++) {
+                       if (!m_convert(mp, msgs.msgs[msgnum])) {
+                               /* sysexits.h EX_USAGE */
+                               exit(1);
+                       }
+               }
                seq_setprev(mp);  /* set the previous-sequence */
 
                if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1),
@@ -241,7 +244,7 @@ main(int argc, char **argv)
        }
 
        if (!*cts)
-               done(1);
+               exit(1);
 
        userrs = 1;
        SIGNAL(SIGQUIT, quitser);
@@ -282,8 +285,7 @@ main(int argc, char **argv)
                context_save();  /* save the context file  */
        }
 
-       done(0);
-       return 1;
+       return 0;
 }
 
 
@@ -297,6 +299,6 @@ pipeser(int i)
                fflush(stderr);
        }
 
-       done(1);
+       exit(1);
        /* NOTREACHED */
 }
index 7e170a8b4e51d0d8eda916f1d6d18a3e2fca7682..46b16fd21d58decf6ad9d2f8c38835362be31587 100644 (file)
@@ -66,7 +66,8 @@ 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);
 
@@ -75,10 +76,10 @@ main(int argc, char **argv)
                                                "%s addrs... [switches]",
                                                invo_name);
                                print_help(buf, switches, 0);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case FROMSW:
                                if (!(from = *argp++) || *from == '-')
@@ -182,7 +183,8 @@ main(int argc, char **argv)
                        if (in == -1 || out == -1) {
                                fprintf(stderr, "Letter left at %s.\n",
                                                tmpfil);
-                               done(status ? 1 : 0);
+                               /* sysexits.h exit-status from spost */
+                               exit(status ? 1 : 0);
                        }
                        cpydata(in, out, tmpfil, "dead.letter");
                        close(in);
@@ -190,7 +192,8 @@ main(int argc, char **argv)
                        fprintf(stderr, "Letter saved in dead.letter\n");
                }
                unlink(tmpfil);
-               done(status ? 1 : 0);
+               /* sysexits.h exit status from spost */
+               exit(status ? 1 : 0);
        }
 
        return 0;  /* dead code to satisfy the compiler */
@@ -201,6 +204,6 @@ static void
 intrser(int i)
 {
        unlink(tmpfil);
-       done(i != 0 ? 1 : 0);
+       exit(i != 0 ? 1 : 0);
 }
 
index dce2d753f3d666823ff574808ce749b6e2ecc707..1d9537728441bd0ec47dd28cf93e71b361d1c2db 100644 (file)
@@ -140,17 +140,18 @@ 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 [profile-components] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case COMPSW:
                                components = 1;
@@ -218,8 +219,7 @@ main(int argc, char **argv)
                }
        }
 
-       done(missed);
-       return 1;
+       return missed;
 }
 
 
index af460e6a0df624ea9b5b3a1b6eae9a380834f6e5..205c41a0cf60c43b2712bd53eee3936d2c3d8571 100644 (file)
@@ -137,7 +137,7 @@ pidcheck(int status)
 
        fflush(stdout);
        fflush(stderr);
-       done(1);
+       exit(1);
        return 1;
 }
 
index a8de5cb2c4695960670f0d574826cbfa3bb2b292..67408ed9897192df05aa2d947b1c87c566f28e1a 100644 (file)
@@ -44,17 +44,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1); //sysexits.h EX_TEMPFAIL
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0); //sysexits.h EX_OK
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0); //sysexits.h EX_OK
                        }
                }
                if (*cp == '+' || *cp == '@') {
@@ -73,7 +73,7 @@ main(int argc, char **argv)
        /* If no messages are given, print folder pathname */
        if (!msgs.size) {
                printf("%s\n", maildir);
-               done(0);
+               exit(0); //sysexits.h EX_OK
        }
 
        if (chdir(maildir) == NOTOK)
@@ -108,9 +108,11 @@ main(int argc, char **argv)
        mp->msgflags |= ALLOW_BEYOND;  /* allow the beyond sequence */
 
        /* parse all the message ranges/sequences and set SELECTED */
-       for (i = 0; i < msgs.size; i++)
-               if (!m_convert(mp, msgs.msgs[i]))
-                       done(1);
+       for (i = 0; i < msgs.size; i++) {
+               if (!m_convert(mp, msgs.msgs[i])) {
+                       exit(1); //sysexits.h EX_USAGE
+               }
+       }
 
        seq_setprev(mp);  /* set the previous-sequence */
 
@@ -122,6 +124,5 @@ main(int argc, char **argv)
        seq_save(mp);  /* synchronize message sequences */
        context_save();  /* save the context file */
        folder_free(mp);  /* free folder/message structure */
-       done(0);
-       return 1;
+       return 0;
 }
index 0b49b7e887273c10a7c7def006d5b2fa3c430b96..9bc7ed325389bd6b047f5ad1bbcc2c85f1ae8ecb 100644 (file)
@@ -75,7 +75,7 @@ void show_all_messages(CT *);
 /* mhfree.c */
 void free_content(CT);
 extern CT *cts;
-void freects_done(int) NORETURN;
+void freects_done();
 
 /*
 ** static prototypes
@@ -98,7 +98,7 @@ main(int argc, char **argv)
        FILE *fp;
        int ontty = 0;
 
-       done=freects_done;
+       atexit(freects_done);
 
        setlocale(LC_ALL, "");
        invo_name = mhbasename(argv[0]);
@@ -122,17 +122,18 @@ 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] %s[switches]", invo_name, mode==SHOW ? "[msgs] " : "");
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case PARTSW:
                                if (!(cp = *argp++) || *cp == '-')
@@ -284,7 +285,8 @@ main(int argc, char **argv)
                /* parse all the message ranges/sequences and set SELECTED */
                for (msgnum = 0; msgnum < msgs.size; msgnum++)
                        if (!m_convert(mp, msgs.msgs[msgnum]))
-                               done(1);
+                               /* sysexits.h EX_USAGE */
+                               exit(1);
 
                /*
                ** Set the SELECT_UNSEEN bit for all the SELECTED messages,
@@ -318,7 +320,7 @@ main(int argc, char **argv)
        }
 
        if (!*cts)
-               done(1);
+               exit(1);
 
        userrs = 1;
        SIGNAL(SIGQUIT, quitser);
@@ -367,8 +369,7 @@ main(int argc, char **argv)
                context_save();                    /* save the context file */
        }
 
-       done(0);
-       return 1;
+       return 0;
 }
 
 
@@ -382,7 +383,7 @@ pipeser(int i)
                fflush(stderr);
        }
 
-       done(1);
+       exit(1);
        /* NOTREACHED */
 }
 
index ae812ad3bac8c702801f5a7a35f26ae7321538e7..5b56b090f3bb853744d196b3bbb6df10b7648311 100644 (file)
@@ -64,7 +64,7 @@ void flush_errors(void);
 /* mhfree.c */
 void free_content(CT);
 extern CT *cts;  /* The list of top-level contents to display */
-void freects_done(int) NORETURN;
+void freects_done();
 
 /*
 ** static prototypes
@@ -130,7 +130,7 @@ main(int argc, char **argv)
        CT ct, *ctp;
        FILE *fp;
 
-       done=freects_done;
+       atexit(freects_done);
 
        setlocale(LC_ALL, "");
        invo_name = mhbasename(argv[0]);
@@ -149,17 +149,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case AUTOSW:
                                autosw++;
@@ -286,7 +286,7 @@ main(int argc, char **argv)
                /* parse all the message ranges/sequences and set SELECTED */
                for (msgnum = 0; msgnum < msgs.size; msgnum++)
                        if (!m_convert(mp, msgs.msgs[msgnum]))
-                               done(1);
+                               exit(1);
                seq_setprev(mp);  /* set the previous-sequence */
 
                if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1),
@@ -306,7 +306,7 @@ main(int argc, char **argv)
        }
 
        if (!*cts)
-               done(1);
+               exit(1);
 
        userrs = 1;
        SIGNAL(SIGQUIT, quitser);
@@ -347,8 +347,7 @@ main(int argc, char **argv)
                context_save();  /* save the context file  */
        }
 
-       done(0);
-       return 1;
+       return 0;
 }
 
 
@@ -362,7 +361,7 @@ pipeser(int i)
                fflush(stderr);
        }
 
-       done(1);
+       exit(1);
        /* NOTREACHED */
 }
 
index 1c1684f444b893059a6e99a4c6f8e1176487eea9..a1718db77e082691d8857d63c457cd0ecc155a23 100644 (file)
@@ -75,7 +75,7 @@ void flush_errors(void);
 /* mhfree.c */
 void free_content(CT);
 extern CT *cts;
-void freects_done(int) NORETURN;
+void freects_done();
 
 /*
 ** static prototypes
@@ -95,7 +95,7 @@ main(int argc, char **argv)
        struct msgs *mp = NULL;
        CT ct, *ctp;
 
-       done=freects_done;
+       atexit(freects_done);
 
        setlocale(LC_ALL, "");
        invo_name = mhbasename(argv[0]);
@@ -114,17 +114,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case PARTSW:
                                if (!(cp = *argp++) || *cp == '-')
@@ -233,7 +233,7 @@ main(int argc, char **argv)
                /* parse all the message ranges/sequences and set SELECTED */
                for (msgnum = 0; msgnum < msgs.size; msgnum++)
                        if (!m_convert(mp, msgs.msgs[msgnum]))
-                               done(1);
+                               exit(1);
                seq_setprev(mp);  /* set the previous-sequence */
 
                if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1),
@@ -253,7 +253,7 @@ main(int argc, char **argv)
        }
 
        if (!*cts)
-               done(1);
+               exit(1);
 
        userrs = 1;
        SIGNAL(SIGQUIT, quitser);
@@ -294,8 +294,7 @@ main(int argc, char **argv)
                context_save();  /* save the context file  */
        }
 
-       done(0);
-       return 1;
+       return 0;
 }
 
 
@@ -324,6 +323,6 @@ pipeser(int i)
                fflush(stderr);
        }
 
-       done(1);
+       exit(1);
        /* NOTREACHED */
 }
index a43a710fe6fc392d7ef6a6158add3356f96435a2..1ea90103c1110a925b5234b79e9cb40a779e1147 100644 (file)
--- a/uip/new.c
+++ b/uip/new.c
@@ -457,7 +457,7 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
@@ -466,10 +466,10 @@ main(int argc, char **argv)
                                                "%s [switches] [sequences]",
                                                invo_name);
                                print_help(help, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case FOLDERSSW:
                                if (!(folders = *argp++) || *folders == '-')
@@ -526,7 +526,7 @@ main(int argc, char **argv)
 
        folder = doit(context_find(curfolder), folders, sequences);
        if (folder == NULL) {
-               done(0);
+               exit(0);
                return 1;
        }
 
@@ -550,6 +550,5 @@ main(int argc, char **argv)
 
        context_save();
 
-       done(0);
-       return 1;
+       return 0;
 }
index 763b6e708b9369d9f5c59bde5bbd60d9258f7b18..f9d02e8f5da56de4520a2aaf2c86eb23281bcc30 100644 (file)
@@ -47,17 +47,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
                        }
                }
                if (*cp == '+' || *cp == '@') {
@@ -90,7 +90,7 @@ main(int argc, char **argv)
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
                if (!m_convert(mp, msgs.msgs[msgnum]))
-                       done(1);
+                       exit(1);
        seq_setprev(mp);  /* set the previous-sequence */
 
        /* copy all the SELECTED messages to stdout */
@@ -113,6 +113,5 @@ main(int argc, char **argv)
        seq_save(mp);
        context_save();
        folder_free(mp);
-       done(0);
-       return 1;
+       return 0;
 }
index e94c259392cb0fbb8363cb41c5c6002b2460eb61..7c42b42af9d744e7ec92fad3a68b5bf6844b19f9 100644 (file)
@@ -76,7 +76,7 @@ static int pmatches(FILE *, int, long, long);
 
 static int listsw = -1;
 
-static void putzero_done(int) NORETURN;
+static void putzero_done();
 
 int
 main(int argc, char **argv)
@@ -91,7 +91,7 @@ main(int argc, char **argv)
        struct msgs *mp;
        register FILE *fp;
 
-       done=putzero_done;
+       atexit(putzero_done);
 
        setlocale(LC_ALL, "");
        invo_name = mhbasename(argv[0]);
@@ -112,7 +112,7 @@ main(int argc, char **argv)
                        case AMBIGSW:
                                ambigsw(cp, switches);
                                listsw = 0;  /* HACK */
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
@@ -120,11 +120,11 @@ main(int argc, char **argv)
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
                                listsw = 0;  /* HACK */
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
                                listsw = 0;  /* HACK */
-                               done(1);
+                               exit(0);
 
                        case CCSW:
                        case DATESW:
@@ -163,7 +163,8 @@ main(int argc, char **argv)
                                        adios(NULL, "too many sequences (more than %d) specified", NUMATTRS);
 
                                if (!seq_nameok(cp))
-                                 done(1);
+                                 /* sysexits.h EX_USAGE */
+                                 exit(1);
 
                                seqs[seqp++] = cp;
                                continue;
@@ -223,7 +224,7 @@ main(int argc, char **argv)
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
                if (!m_convert(mp, msgs.msgs[msgnum]))
-                       done(1);
+                       exit(1);
        seq_setprev(mp);  /* set the previous-sequence */
 
        /*
@@ -238,7 +239,8 @@ main(int argc, char **argv)
                                folder);
 
        if (!pcompile(vec, NULL))
-               done(1);
+               /* sysexits.h EX_USAGE */
+               exit(1);
 
        lo = mp->lowsel;
        hi = mp->hghsel;
@@ -289,7 +291,8 @@ main(int argc, char **argv)
        */
        for (seqp = 0; seqs[seqp]; seqp++)
                if (!seq_addsel(mp, seqs[seqp], publicsw, zerosw))
-                       done(1);
+                       /* sysexits.h EX_IOERR */
+                       exit(1);
 
        /*
        ** Print total matched if not printing each matched message number.
@@ -302,17 +305,16 @@ main(int argc, char **argv)
        seq_save(mp);  /* synchronize message sequences */
        context_save();  /* save the context file */
        folder_free(mp);  /* free folder/message structure */
-       done(0);
-       return 1;
+       return 0;
 }
 
 
 static void
-putzero_done(int status)
+putzero_done()
 {
-       if (listsw && status && !isatty(fileno(stdout)))
+       if (listsw && !isatty(fileno(stdout))) {
                printf("0\n");
-       exit(status);
+       }
 }
 
 
index 823760ef49b91e48b3be607a1541281e8ecdf178..03038a6bc25928fd91760f43b5b59f4d9ea59c4e 100644 (file)
@@ -71,7 +71,7 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
@@ -80,10 +80,10 @@ main(int argc, char **argv)
                                                "%s [switches] file",
                                                invo_name);
                                print_help(buffer, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case PREPSW:
                                prepend++;
@@ -160,7 +160,8 @@ main(int argc, char **argv)
                                if (i == -1) {
 abort:
                                        unlink(tmpfil);
-                                       done(1);
+                                       /* sysexits.h EX_DATAERR */
+                                       exit(1);
                                }
                                if (i || (field[0]!='\n' && field[0]!='\0')) {
                                        fprintf(out, "%s:", name);
@@ -254,8 +255,7 @@ has_no_body:
        unlink(tmpfil);
 
        context_save();  /* save the context file */
-       done(0);
-       return 1;
+       return 0;
 }
 
 
index 2ba609771454bffa9affb3d030fadf3351a88923..d3e41001af88b6f23b2c4c66ad888d2dd0c0ae88 100644 (file)
@@ -30,7 +30,7 @@ static char tmpfil[BUFSIZ] = "";
 ** prototypes
 */
 static void rcvdistout(FILE *, char *, char *);
-static void unlink_done(int) NORETURN;
+static void unlink_done();
 
 
 int
@@ -42,7 +42,7 @@ main(int argc, char **argv)
        FILE *fp;
        char *tfile = NULL;
 
-       done=unlink_done;
+       atexit(unlink_done);
 
        setlocale(LC_ALL, "");
        invo_name = mhbasename(argv[0]);
@@ -58,7 +58,7 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                vec[vecp++] = --cp;
                                continue;
@@ -66,10 +66,10 @@ main(int argc, char **argv)
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [switches] [switches for spost] address ...", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case FORMSW:
                                if (!(form = *argp++) || *form == '-') {
@@ -103,7 +103,8 @@ main(int argc, char **argv)
        fclose(fp);
 
        if (distout(drft, tmpfil, backup) == NOTOK) {
-               done(1);
+               /* sysexits.h EX_DATAERR */
+               exit(1);
        }
 
        vec[0] = "spost";
@@ -275,7 +276,7 @@ finished: ;
 
 
 static void
-unlink_done(int status)
+unlink_done()
 {
        if (*backup) {
                unlink(backup);
@@ -286,5 +287,4 @@ unlink_done(int status)
        if (*tmpfil) {
                unlink(tmpfil);
        }
-       exit(status ? RCV_MBX : RCV_MOK);
 }
index 79c3450491c854b7ba130dce6f7d3f24d812293f..352f785b6bbf0affc7ed33ac6b48086d602764d2 100644 (file)
@@ -42,7 +42,7 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
@@ -51,10 +51,10 @@ main(int argc, char **argv)
                                                "%s [switches] file",
                                                invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
                        }
                }
                if (file)
@@ -66,27 +66,27 @@ main(int argc, char **argv)
        /* copy stdin to stdout, converting rfc822 message to mbox */
        if (!file) {
                if (mbox_copy(fileno(stdout), fileno(stdin)) == NOTOK) {
-                       done(RCV_MBX);
+                       exit(RCV_MBX);
                }
-               done(RCV_MOK);
+               exit(RCV_MOK);
                return 1;
        }
 
        /* open and lock the file */
        if ((md = mbox_open(file, getuid(), getgid(), m_gmprot()))
                        == NOTOK)
-               done(RCV_MBX);
+               exit(RCV_MBX);
 
        /* append the message */
        if (mbox_copy(md, fileno(stdin)) == NOTOK) {
                mbox_close(file, md);
-               done(RCV_MBX);
+               exit(RCV_MBX);
        }
 
        /* close and unlock the file */
        if (mbox_close(file, md) == NOTOK)
-               done(RCV_MBX);
+               exit(RCV_MBX);
 
-       done(RCV_MOK);
+       exit(RCV_MOK);
        return 1;
 }
index bb14ed98d6e92860404fdfe84bfcecaad3fdd217..fbddda7faba9d0fc51df3d34e004c157df56513a 100644 (file)
@@ -44,7 +44,7 @@ static struct swit switches[] = {
 */
 static char *tmpfilenam = NULL;
 
-static void unlink_done(int) NORETURN;
+static void unlink_done();
 
 int
 main(int argc, char **argv)
@@ -58,7 +58,7 @@ main(int argc, char **argv)
        struct msgs *mp;
        struct stat st;
 
-       done=unlink_done;
+       atexit(unlink_done);
 
        setlocale(LC_ALL, "");
        invo_name = mhbasename(argv[0]);
@@ -75,7 +75,7 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
@@ -84,10 +84,10 @@ main(int argc, char **argv)
                                                "%s [+folder] [switches]",
                                                invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(1);
 
                        case SEQSW:
                                if (!(cp = *argp++) || *cp == '-')
@@ -186,7 +186,7 @@ main(int argc, char **argv)
        if (st.st_size == 0) {
                unlink(tmpfilenam);
                advise(NULL, "empty file");
-               done(0);
+               exit(0);
        }
 
        /*
@@ -201,7 +201,7 @@ main(int argc, char **argv)
        */
        if ((msgnum = folder_addmsg(&mp, tmpfilenam, 0, unseensw, 0, 0, NULL))
                        == -1)
-               done(1);
+               exit(1);
 
        /*
        ** Add the message to any extra sequences
@@ -209,7 +209,7 @@ main(int argc, char **argv)
        */
        for (seqp = 0; seqs[seqp]; seqp++) {
                if (!seq_addmsg(mp, seqs[seqp], msgnum, publicsw, zerosw))
-                       done(1);
+                       exit(1);
        }
 
        seq_setunseen(mp, 1);  /* add new msgs to unseen sequences */
@@ -220,17 +220,16 @@ main(int argc, char **argv)
        unlink(tmpfilenam);  /* remove temporary file */
        tmpfilenam = NULL;
 
-       done(0);
-       return 1;
+       return 0;
 }
 
 /*
 ** Clean up and exit
 */
 static void
-unlink_done(int status)
+unlink_done()
 {
-       if (tmpfilenam && *tmpfilenam)
+       if (tmpfilenam && *tmpfilenam) {
                unlink(tmpfilenam);
-       exit(status);
+       }
 }
index b07c32d275a3e78b0dc8985acdfd7739eb61c416..cdada9baf5dfef1abdb38f9ef49f7100606723c2 100644 (file)
@@ -73,17 +73,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown\n", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [msgs] [switches] +folder ...", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case LINKSW:
                                linkf++;
@@ -132,7 +132,8 @@ main(int argc, char **argv)
                opnfolds(folders, foldp);
                for (i = 0; i < filep; i++)
                        if (m_file(files[i], folders, foldp, 0))
-                               done(1);
+                               /* sysexits.h EX_IOERR */
+                               exit(1);
                /* If -nolink, then unlink files */
                if (!linkf) {
                        int i;
@@ -144,7 +145,7 @@ main(int argc, char **argv)
                                        admonish(files[i], "unable to unlink");
                        }
                }
-               done(0);
+               exit(0);
        }
 
        if (!msgs.size)
@@ -167,7 +168,8 @@ main(int argc, char **argv)
        /* parse the message range/sequence/name and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
                if (!m_convert(mp, msgs.msgs[msgnum]))
-                       done(1);
+                       /* sysexits.h EX_USAGE */
+                       exit(1);
        seq_setprev(mp);  /* set the previous-sequence */
 
        /* create folder structures for each destination folder */
@@ -183,7 +185,8 @@ main(int argc, char **argv)
                if (is_selected(mp, msgnum)) {
                        cp = getcpy(m_name(msgnum));
                        if (m_file(cp, folders, foldp, !linkf))
-                               done(1);
+                               /* sysexits.h EX_IOERR */
+                               exit(1);
                        free(cp);
                }
        }
@@ -208,8 +211,7 @@ main(int argc, char **argv)
        context_replace(curfolder, folder);
        context_save();
        folder_free(mp);
-       done(0);
-       return 1;
+       return 0;
 }
 
 
index e5fbc0ffaf8bb7f79a38ff3524e86046ee8bb4a6..42bcfdc5d72869c661a90889d7221b51ac4a9c10 100644 (file)
@@ -157,17 +157,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               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(0);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case GROUPSW:
                                groupreply++;
@@ -315,7 +315,8 @@ main(int argc, char **argv)
 
                /* 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)
@@ -344,9 +345,9 @@ main(int argc, char **argv)
        fclose(in);
 
        if (buildsw)
-               done(0);
+               exit(0);
        what_now(ed, NOUSE, drft, msg, 0, mp, anot ? "Replied" : NULL, cwd);
-       done(1);
+       /* sysexits.h EX_SOFTWARE */
        return 1;
 }
 
@@ -356,7 +357,7 @@ docc(char *cp, int ccflag)
        switch (smatch(cp, ccswitches)) {
        case AMBIGSW:
                ambigsw(cp, ccswitches);
-               done(1);
+               exit(1);
        case UNKWNSW:
                adios(NULL, "-%scc %s unknown", ccflag ? "" : "no", cp);
 
@@ -771,7 +772,8 @@ replfilter(FILE *in, FILE *out, char *filter)
 
        default:
                if (pidXwait(pid, "mhl"))
-                       done(1);
+                       /* sysexits.h EX_SOFTWARE */
+                       exit(1);
                fseek(out, 0L, SEEK_END);
                break;
        }
index a0c68a36e1b5738615d92a9af91a3d640acaac51..164ec77b48f979124a14ec00fd96621af6f061be 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -48,17 +48,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case INTRSW:
                                interactive = 1;
@@ -105,7 +105,7 @@ main(int argc, char **argv)
        if (interactive) {
                cp = concat("Remove folder \"", folder, "\"? ", NULL);
                if (!getanswer(cp))
-                       done(0);
+                       exit(0);
                free(cp);
        }
 
@@ -118,8 +118,7 @@ main(int argc, char **argv)
                }
        }
        context_save();  /* save the context file */
-       done(0);
-       return 1;
+       return 0;
 }
 
 static int
index f6026411a6de5b1726e7e76adade4c4cd80465be..9401d2bea85bf4f1d9e6652e1f75f60f52dc690e 100644 (file)
--- a/uip/rmm.c
+++ b/uip/rmm.c
@@ -47,17 +47,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown\n", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case UNLINKSW:
                                unlink_msgs++;
@@ -104,7 +104,8 @@ main(int argc, char **argv)
        */
        for (msgnum = 0; msgnum < msgs.size; msgnum++) {
                if (!m_convert(mp, msgs.msgs[msgnum])) {
-                       done(1);
+                       /* sysexits EX_USAGE */
+                       exit(1);
                }
        }
 
@@ -117,8 +118,7 @@ main(int argc, char **argv)
                seq_setprev(mp);
                seq_save(mp);
                folder_free(mp);
-               done(0);
-               return 1;
+               return 0;
        }
 
        /* remove by refiling. */
@@ -156,6 +156,5 @@ main(int argc, char **argv)
                pidwait(pid, -1);
        }
 
-       done(0);
-       return 1;
+       return 0;
 }
index ba90e4010ee23851abf6bfb1aa0730b40dd9dfe5..29aea6560c786761cae1b561f289a7ca03cda223 100644 (file)
@@ -58,17 +58,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case FORMSW:
                                if (!(form = *argp++) || *form == '-')
@@ -130,7 +130,7 @@ main(int argc, char **argv)
                                break;
                }
                fclose(in);
-               done(0);
+               exit(0);
        }
 
        /*
@@ -157,7 +157,7 @@ main(int argc, char **argv)
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
                if (!m_convert(mp, msgs.msgs[msgnum]))
-                       done(1);
+                       exit(1);
        seq_setprev(mp);  /* set the Previous-Sequence */
 
        context_replace(curfolder, folder);  /* update current folder */
@@ -222,6 +222,5 @@ main(int argc, char **argv)
 
        folder_free(mp);  /* free folder/message structure */
 
-       done(0);
-       return 1;
+       return 0;
 }
index 837f038d71ab2c55ca5b126c1f9c455bbfc6a0af..ff8df8c8280520ee5e08209405c2af03c61a7b11 100644 (file)
@@ -186,17 +186,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [switches] [address info sender]", invo_name);
                                print_help(buf, switches, 0);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case ADDRSW:
                                if (!(addr = *argp++)) {
@@ -397,8 +397,7 @@ main(int argc, char **argv)
        /* deliver the message */
        status = localmail(fd, mdlvr);
 
-       done(status != -1 ? RCV_MOK : RCV_MBX);
-       return 1;
+       return (status != -1 ? RCV_MOK : RCV_MBX);
 }
 
 
index ed0918158eb924bbcd8f43f40209101172878d01..0230495e316a3037e7da3cc06c844166e7783568 100644 (file)
@@ -90,17 +90,17 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case DATESW:
                                if (datesw)
@@ -179,7 +179,7 @@ main(int argc, char **argv)
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
                if (!m_convert(mp, msgs.msgs[msgnum]))
-                       done(1);
+                       exit(1);
        seq_setprev(mp);  /* set the previous sequence */
 
        if ((nmsgs = read_hdrs(mp, datesw)) <= 0)
@@ -274,8 +274,7 @@ main(int argc, char **argv)
        seq_save(mp);  /* synchronize message sequences */
        context_save();  /* save the context file */
        folder_free(mp);  /* free folder/message structure */
-       done(0);
-       return 1;
+       return 0;
 }
 
 static int
index b65e4c4227214524050055bb3779a3d5498b8011..bfa8f4bed99e92a9743d02a0bc015e73340f47bf 100644 (file)
@@ -149,7 +149,7 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
@@ -158,10 +158,10 @@ main(int argc, char **argv)
                                                "%s [switches] file",
                                                invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case DEBUGSW:
                                debug++;
@@ -262,7 +262,7 @@ main(int argc, char **argv)
 
        if (debug) {
                /* stop here */
-               done(0);
+               exit(0);
        }
 
        fclose(out);
index 914e2989cb6d08faa460cc640138e7320f9b5b0c..fbc85822a08e83611ec63f4d3ac61f54f1e3da05 100644 (file)
@@ -110,7 +110,7 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
@@ -119,10 +119,10 @@ main(int argc, char **argv)
                                                "%s [switches] [file]",
                                                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 == '-')
@@ -161,14 +161,15 @@ main(int argc, char **argv)
                                unlink(drft);
                        }
                        advise(NULL, "Try again.");
-                       done(1);
+                       /* sysexits.h EX_SOFTWARE */
+                       exit(1);
                }
        }
 
        snprintf(prompt, sizeof(prompt), myprompt, invo_name);
        for (;;) {
                if (!(argp = getans(prompt, aleqs))) {
-                       done(1);
+                       exit(1);
                }
                switch (smatch(*argp, aleqs)) {
                case DISPSW:
@@ -199,12 +200,12 @@ main(int argc, char **argv)
                        if (stat(drft, &st) != NOTOK) {
                                advise(NULL, "draft left on %s", drft);
                        }
-                       done(1);
+                       exit(1);
 
                case DELETESW:
                        /* Delete draft and exit */
                        removefile(drft);
-                       done(1);
+                       exit(1);
 
                case SENDSW:
                        /* Send draft */
@@ -214,7 +215,7 @@ main(int argc, char **argv)
                case REFILEOPT:
                        /* Refile the draft */
                        if (refile(++argp, drft) == 0) {
-                               done(0);
+                               exit(0);
                        }
                        break;
 
@@ -592,7 +593,7 @@ sendfile(char **arg, char *file)
 
        default:
                if (pidwait(child_id, OK) == 0)
-                       done(0);
+                       exit(0);
                return 1;
        }
 }
index 57fddc8eda1f889fe9e317cf619289215ce9c2f6..fb77ab374aba764cd25ddafa5685976b47fd9c4f 100644 (file)
@@ -85,7 +85,7 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               exit(1);
 
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
@@ -95,10 +95,10 @@ main(int argc, char **argv)
                                                "%s [switches] file ...",
                                                invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case TOCCSW:
                                toccsw = 1;