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

1  2 
uip/mhl.c
uip/mhmail.c
uip/mhparse.c
uip/mhstore.c
uip/pick.c
uip/prompter.c
uip/send.c

diff --cc uip/mhl.c
+++ b/uip/mhl.c
@@@ -573,10 -565,10 +565,9 @@@ process(char *fname, int ofilen, int of
        FILE *fp = NULL;
        struct mcomp *c1;
  
 -      switch (setjmp(env)) {
 -      case OK:
 +      if (setjmp(env) == 0) {
                if (fname) {
-                       fp = mhl_action ? (*mhl_action) (fname) :
-                                       fopen(fname, "r");
+                       fp = fopen(fname, "r");
                        if (fp == NULL) {
                                advise(fname, "unable to open");
                                exitstat++;
                }
                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 (mhl_action == NULL && fp != stdin)
++      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;
  }
  
  
diff --cc uip/mhmail.c
@@@ -159,25 -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);
-                       done(status ? 1 : 0);
++                      /* 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);
-       done(status ? 1 : 0);
-       return 0;  /* dead code to satisfy the compiler */
++      /* sysexits.h exit status from spost */
++      exit(status ? 1 : 0);
  }
  
  
diff --cc uip/mhparse.c
Simple merge
diff --cc uip/mhstore.c
Simple merge
diff --cc uip/pick.c
@@@ -163,7 -163,7 +163,7 @@@ main(int argc, char **argv
                                        adios(NULL, "too many sequences (more than %d) specified", NUMATTRS);
  
                                if (!seq_nameok(cp))
-                                       done(1);
 -                                exit(1);
++                                      exit(1);
  
                                seqs[seqp++] = cp;
                                continue;
diff --cc uip/prompter.c
Simple merge
diff --cc uip/send.c
@@@ -288,27 -283,26 +283,22 @@@ sendsbr(char **vec, int vecp, char *drf
                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);
 -      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);
+               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);
 -              break;
 -
 -      default:
 +      } else {
                status = DONE;
 -              break;
        }
  
-       done=exit;
        if (distfile) {
                unlink(distfile);
        }