X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Frcvdist.c;h=d3e41001af88b6f23b2c4c66ad888d2dd0c0ae88;hb=2823e13f67239db7deb7274f3a47bfbff56c7c64;hp=58bf62dda2a4a26254724d7119ea7cb059997bc5;hpb=e0422dfed4d6d236e5298cea579587870b83384a;p=mmh diff --git a/uip/rcvdist.c b/uip/rcvdist.c index 58bf62d..d3e4100 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -14,9 +14,9 @@ static struct swit switches[] = { #define FORMSW 0 - { "form formfile", 4 }, + { "form formfile", 0 }, #define VERSIONSW 1 - { "version", 0 }, + { "Version", 0 }, #define HELPSW 2 { "help", 0 }, { NULL, 0 } @@ -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,11 +42,9 @@ main(int argc, char **argv) FILE *fp; char *tfile = NULL; - done=unlink_done; + atexit(unlink_done); -#ifdef LOCALE setlocale(LC_ALL, ""); -#endif invo_name = mhbasename(argv[0]); /* read user profile/context */ @@ -60,18 +58,18 @@ main(int argc, char **argv) switch (smatch(++cp, switches)) { case AMBIGSW: ambigsw(cp, switches); - done(1); + exit(1); case UNKWNSW: vec[vecp++] = --cp; continue; case HELPSW: - snprintf(buf, sizeof(buf), "%s [switches] [switches for postproc] address ...", invo_name); + 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 == '-') { @@ -85,7 +83,7 @@ main(int argc, char **argv) } if (!addrs) { - adios(NULL, "usage: %s [switches] [switches for postproc] address ...", invo_name); + adios(NULL, "usage: %s [switches] [switches for spost] address ...", invo_name); } umask(~m_gmprot()); @@ -105,17 +103,18 @@ main(int argc, char **argv) fclose(fp); if (distout(drft, tmpfil, backup) == NOTOK) { - done(1); + /* sysexits.h EX_DATAERR */ + exit(1); } - vec[0] = mhbasename(postproc); + vec[0] = "spost"; vec[vecp++] = "-dist"; vec[vecp++] = drft; vec[vecp] = NULL; - execvp(postproc, vec); + execvp(*vec, vec); fprintf(stderr, "unable to exec "); - perror(postproc); + perror(*vec); _exit(1); return 0; /* dead code to satisfy the compiler */ } @@ -277,7 +276,7 @@ finished: ; static void -unlink_done(int status) +unlink_done() { if (*backup) { unlink(backup); @@ -288,5 +287,4 @@ unlink_done(int status) if (*tmpfil) { unlink(tmpfil); } - exit(status ? RCV_MBX : RCV_MOK); }