Merge branch 'master' of ssh://marmaro.de:443/var/git/mmh
authormarkus schnalke <meillo@marmaro.de>
Sat, 14 Feb 2015 16:44:14 +0000 (17:44 +0100)
committermarkus schnalke <meillo@marmaro.de>
Sat, 14 Feb 2015 16:44:14 +0000 (17:44 +0100)
Conflicts:
uip/mhl.c
uip/mhlist.c
uip/mhmail.c
uip/pick.c
uip/send.c

man/mhmail.man1
sbr/execprog.c
uip/mhl.c
uip/mhmail.c
uip/mhparse.c
uip/mhshowsbr.c
uip/mhstore.c
uip/pick.c
uip/prompter.c
uip/send.c

index b2381c1..acecbbc 100644 (file)
@@ -124,12 +124,12 @@ This program was intended for the use of programs such as
 which expect to send mail automatically to various
 addresses.  It was also used by various
 .B nmh
-commands to mail various
-error notifications.
+commands to mail various error notifications.
 .PP
-When invoked without arguments, it had simply invokes
+When invoked without arguments, it had once simply invoked
 .B inc
 to incorporate new messages from the user's maildrop.
+It does this no longer.
 
 .SH BUGS
 .B mhmail
index 9cc8879..ce38307 100644 (file)
@@ -27,7 +27,7 @@ execprog(char *cmd, char **arg)
 
        default:
                /* parent */
-               return (pidwait(pid, -1) & 0377 ? 1 : 0);
+               return pidXwait(pid, cmd);
        }
 
        return 1;  /* NOT REACHED */
index 45113f3..5403673 100644 (file)
--- a/uip/mhl.c
+++ b/uip/mhl.c
@@ -565,8 +565,7 @@ process(char *fname, int ofilen, int ofilec)
        FILE *fp = NULL;
        struct mcomp *c1;
 
-       switch (setjmp(env)) {
-       case OK:
+       if (setjmp(env) == 0) {
                if (fname) {
                        fp = fopen(fname, "r");
                        if (fp == NULL) {
@@ -580,20 +579,18 @@ process(char *fname, int ofilen, int ofilec)
                }
                SIGNAL(SIGINT, intrser);
                mhlfile(fp, fname, ofilen, ofilec);
-               /* FALL THROUGH! */
-       default:
-               SIGNAL(SIGINT, SIG_IGN);
-               if (fp != stdin)
-                       fclose(fp);
-               if (holder.c_text) {
-                       free(holder.c_text);
-                       holder.c_text = NULL;
-               }
-               free_queue(&msghd, &msgtl);
-               for (c1 = fmthd; c1; c1 = c1->c_next)
-                       c1->c_flags &= ~HDROUTPUT;
-               break;
        }
+
+       SIGNAL(SIGINT, SIG_IGN);
+       if (fp != stdin)
+               fclose(fp);
+       if (holder.c_text) {
+               free(holder.c_text);
+               holder.c_text = NULL;
+       }
+       free_queue(&msghd, &msgtl);
+       for (c1 = fmthd; c1; c1 = c1->c_next)
+               c1->c_flags &= ~HDROUTPUT;
 }
 
 
index 46b16fd..9936261 100644 (file)
@@ -40,7 +40,6 @@ static void intrser(int);
 int
 main(int argc, char **argv)
 {
-       pid_t child_id;
        int status, iscc = 0, nvec;
        char *cp, *tolist = NULL, *cclist = NULL, *subject = NULL;
        char *from = NULL, *body = NULL, **argp, **arguments;
@@ -161,42 +160,26 @@ main(int argc, char **argv)
        vec[nvec++] = tmpfil;
        vec[nvec] = NULL;
 
-       if ((child_id = fork()) == NOTOK) {
-               /* report failure and then send it */
-               adios(NULL, "unable to fork");
-
-       } else if (child_id == 0) {
-               /* child process */
-               execvp(*vec, vec);
-               fprintf(stderr, "unable to exec ");
-               perror(*vec);
-               _exit(-1);
-
-       } else {
-               /* parent process */
-               if ((status = pidXwait(child_id, *vec))) {
-                       /* spost failed, save draft as dead.letter */
-                       int in, out;
-
-                       in = open(tmpfil, O_RDONLY);
-                       out = creat("dead.letter", 0600);
-                       if (in == -1 || out == -1) {
-                               fprintf(stderr, "Letter left at %s.\n",
-                                               tmpfil);
-                               /* sysexits.h exit-status from spost */
-                               exit(status ? 1 : 0);
-                       }
-                       cpydata(in, out, tmpfil, "dead.letter");
-                       close(in);
-                       close(out);
-                       fprintf(stderr, "Letter saved in dead.letter\n");
+       if ((status = execprog(*vec, vec))) {
+               /* spost failed, save draft as dead.letter */
+               int in, out;
+
+               in = open(tmpfil, O_RDONLY);
+               out = creat("dead.letter", 0600);
+               if (in == -1 || out == -1) {
+                       fprintf(stderr, "Letter left at %s.\n",
+                                       tmpfil);
+                       /* sysexits.h exit-status from spost */
+                       exit(status ? 1 : 0);
                }
-               unlink(tmpfil);
-               /* sysexits.h exit status from spost */
-               exit(status ? 1 : 0);
+               cpydata(in, out, tmpfil, "dead.letter");
+               close(in);
+               close(out);
+               fprintf(stderr, "Letter saved in dead.letter\n");
        }
-
-       return 0;  /* dead code to satisfy the compiler */
+       unlink(tmpfil);
+       /* sysexits.h exit status from spost */
+       exit(status ? 1 : 0);
 }
 
 
index 205c41a..f4c26cc 100644 (file)
@@ -10,7 +10,6 @@
 #include <fcntl.h>
 #include <h/signals.h>
 #include <errno.h>
-#include <setjmp.h>
 #include <signal.h>
 #include <h/tws.h>
 #include <h/mime.h>
index 71c1699..fe40f9d 100644 (file)
@@ -10,7 +10,6 @@
 #include <fcntl.h>
 #include <h/signals.h>
 #include <errno.h>
-#include <setjmp.h>
 #include <signal.h>
 #include <h/tws.h>
 #include <h/mime.h>
index 5b56b09..6a268f2 100644 (file)
@@ -10,7 +10,6 @@
 #include <fcntl.h>
 #include <h/signals.h>
 #include <errno.h>
-#include <setjmp.h>
 #include <signal.h>
 #include <h/tws.h>
 #include <h/mime.h>
index ae1fa03..6c59add 100644 (file)
@@ -163,7 +163,7 @@ main(int argc, char **argv)
                                        adios(NULL, "too many sequences (more than %d) specified", NUMATTRS);
 
                                if (!seq_nameok(cp))
-                                 exit(1);
+                                       exit(1);
 
                                seqs[seqp++] = cp;
                                continue;
index 03038a6..4d0ce86 100644 (file)
@@ -269,7 +269,7 @@ getln(char *buffer, int n)
        *cp = '\0';
 
        switch (setjmp(sigenv)) {
-       case OK:
+       case 0:
                wtuser = 1;
                break;
 
index 492f027..234dfb2 100644 (file)
@@ -283,8 +283,7 @@ sendsbr(char **vec, int vecp, char *drft, struct stat *st)
                break;
        }
 
-       switch (status = sendaux(vec, vecp, drft, st)) {
-       case OK:
+       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);
@@ -296,11 +295,8 @@ sendsbr(char **vec, int vecp, char *drft, struct stat *st)
                }
                dup2(dupfd, 0);
                close(dupfd);
-               break;
-
-       default:
+       } else {
                status = DONE;
-               break;
        }
 
        if (distfile) {