X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fsend.c;fp=uip%2Fsend.c;h=234dfb29a773b075e3466b05db875fe15fc3732e;hp=13ae761486894030e6e20d6d9f018e9d70884a4e;hb=5a12e4b0477d3ad699f5713682d26079f2792d17;hpb=f9ed40f2742263b3a1023bedee4139b4b18f0a86 diff --git a/uip/send.c b/uip/send.c index 13ae761..234dfb2 100644 --- a/uip/send.c +++ b/uip/send.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -28,8 +27,6 @@ char *altmsg = NULL; char *annotext = NULL; char *distfile = NULL; -static jmp_buf env; - /* name of temp file for body content */ static char body_file_name[MAXPATHLEN + 1]; /* name of mhbuild composition temporary file */ @@ -44,7 +41,6 @@ static FILE *composition_file; /* composition file pointer */ ** static prototypes */ static int sendsbr(char **, int, char *, struct stat *); -static void armed_done(int) NORETURN; static void anno(struct stat *); static int sendaux(char **, int, char *, struct stat *); static int attach(char *); @@ -99,7 +95,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\n", cp); @@ -108,10 +104,10 @@ main(int argc, char **argv) "%s [file] [switches]", invo_name); print_help(buf, switches, 1); - done(1); + exit(0); case VERSIONSW: print_version(invo_name); - done(1); + exit(0); case DEBUGSW: debugsw++; @@ -150,7 +146,7 @@ main(int argc, char **argv) /* parse all the msgranges/sequences and set SELECTED */ for (msgnum = 0; msgnum < nmsgs; msgnum++) { if (!m_convert(mp, msgs[msgnum])) { - done(1); + exit(1); } } seq_setprev(mp); @@ -217,7 +213,7 @@ main(int argc, char **argv) for (n = 0; n < nfiles; n++) { switch (sendsbr(vec, vecp, files[n], &st)) { case DONE: - done(++status); + exit(++status); case NOTOK: status++; /* fall */ case OK: @@ -226,8 +222,7 @@ main(int argc, char **argv) } context_save(); - done(status); - return 1; + return status; } @@ -288,27 +283,22 @@ sendsbr(char **vec, int vecp, char *drft, struct stat *st) break; } - done=armed_done; - if (setjmp(env) == 0) { - status = sendaux(vec, vecp, drft, st) ? NOTOK : OK; - if (status == OK) { - /* move original draft to +trash folder */ - /* temporary close stdin, for refile not to ask */ - dupfd = dup(0); - close(0); - if (execprogl("refile", "refile", "-file", - original_draft, "+trash", - (char *)NULL) != 0) { - advise(NULL, "unable to trash the draft"); - } - dup2(dupfd, 0); - close(dupfd); + if ((status = sendaux(vec, vecp, drft, st)) == OK) { + /* move original draft to +trash folder */ + /* temporary close stdin, for refile not to ask */ + dupfd = dup(0); + close(0); + if (execprogl("refile", "refile", "-file", + original_draft, "+trash", + (char *)NULL) != 0) { + advise(NULL, "unable to trash the draft"); } + dup2(dupfd, 0); + close(dupfd); } else { status = DONE; } - done=exit; if (distfile) { unlink(distfile); } @@ -624,15 +614,15 @@ sendaux(char **vec, int vecp, char *drft, struct stat *st) vec[vecp++] = drft; if (distfile && distout(drft, distfile, backup) == NOTOK) { - done(1); + return DONE; } vec[vecp] = NULL; switch (child_id = fork()) { case -1: /* oops -- fork error */ - adios("fork", "unable to"); - break; /* NOT REACHED */ + advise("fork", "unable to"); + return DONE; case 0: /* child process -- send it */ @@ -663,7 +653,7 @@ sendaux(char **vec, int vecp, char *drft, struct stat *st) } - return status; + return status ? NOTOK : status; } @@ -745,12 +735,3 @@ strexit(int status) return "message not delivered to anyone"; } } - - -static void -armed_done(int status) -{ - longjmp(env, status ? status : NOTOK); - - exit(status); -}