X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Frcvdist.c;h=c3650595da8382af9c3093fa743da0e63432108a;hb=803fbeb16fac49e0b6b1bdf1e4c2874bcf901749;hp=58bf62dda2a4a26254724d7119ea7cb059997bc5;hpb=e0422dfed4d6d236e5298cea579587870b83384a;p=mmh diff --git a/uip/rcvdist.c b/uip/rcvdist.c index 58bf62d..c365059 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; +void unlink_done(); int @@ -42,11 +42,11 @@ main(int argc, char **argv) FILE *fp; char *tfile = NULL; - done=unlink_done; + if (atexit(unlink_done) != 0) { + adios(NULL, "atexit failed"); + } -#ifdef LOCALE setlocale(LC_ALL, ""); -#endif invo_name = mhbasename(argv[0]); /* read user profile/context */ @@ -60,18 +60,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 +85,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 +105,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 */ } @@ -276,8 +277,8 @@ finished: ; } -static void -unlink_done(int status) +void +unlink_done() { if (*backup) { unlink(backup); @@ -288,5 +289,4 @@ unlink_done(int status) if (*tmpfil) { unlink(tmpfil); } - exit(status ? RCV_MBX : RCV_MOK); }