X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Frmm.c;h=520ce036d92026fec8eb00fd3a6a232c45d9a9c1;hb=2abb9a7cfb0930e27062088734d306e7d78e4cc2;hp=f6026411a6de5b1726e7e76adade4c4cd80465be;hpb=0285fea2ad25319da1cbc6637e8e72e2f223b4c0;p=mmh diff --git a/uip/rmm.c b/uip/rmm.c index f602641..520ce03 100644 --- a/uip/rmm.c +++ b/uip/rmm.c @@ -8,6 +8,8 @@ #include #include +#include +#include static struct swit switches[] = { #define UNLINKSW 0 @@ -31,7 +33,6 @@ main(int argc, char **argv) char **arguments; struct msgs_array msgs = { 0, 0, NULL }; struct msgs *mp; - pid_t pid; setlocale(LC_ALL, ""); invo_name = mhbasename(argv[0]); @@ -47,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\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 +105,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 +119,7 @@ main(int argc, char **argv) seq_setprev(mp); seq_save(mp); folder_free(mp); - done(0); - return 1; + return 0; } /* remove by refiling. */ @@ -141,21 +142,5 @@ main(int argc, char **argv) } vec[vecp] = NULL; - fflush(stdout); - switch (pid = fork()) { - case -1: - adios("fork", "unable to"); - - case 0: - execvp(*vec, vec); - fprintf(stderr, "unable to exec "); - perror(*vec); - _exit(-1); - - default: - pidwait(pid, -1); - } - - done(0); - return 1; + return execprog(*vec, vec); }