X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/0a032eea07f6d77ac6ea4d5a39c9491c34358058..8699f1cc:/uip/forw.c?ds=inline diff --git a/uip/forw.c b/uip/forw.c index f4ca981b..288e85a0 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -1,5 +1,4 @@ -/* - * forw.c -- forward a message, or group of messages. +/* forw.c -- forward a message, or group of messages. * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -9,7 +8,9 @@ #include #include #include +#include "h/done.h" #include +#include "sbr/m_maildir.h" #define IFORMAT "digest-issue-%s" @@ -40,7 +41,7 @@ X("nodashstuffing", 0, NBITSTUFFSW) \ X("version", 0, VERSIONSW) \ X("help", 0, HELPSW) \ - X("file file", 4, FILESW) /* interface from msh */ \ + X("file file", 4, FILESW) \ X("build", 5, BILDSW) /* interface from mhe */ \ X("from address", 0, FROMSW) \ X("to address", 0, TOSW) \ @@ -111,7 +112,7 @@ main (int argc, char **argv) char *dmsg = NULL, *digest = NULL, *ed = NULL; char *file = NULL, *filter = NULL, *folder = NULL, *fwdmsg = NULL; char *from = NULL, *to = NULL, *cc = NULL, *subject = NULL, *fcc = NULL; - char *form = NULL, buf[BUFSIZ], value[10]; + char *form = NULL, buf[BUFSIZ]; char **argp, **arguments; struct stat st; struct msgs_array msgs = { 0, 0, NULL }; @@ -247,10 +248,10 @@ main (int argc, char **argv) continue; case BITSTUFFSW: - dashstuff = 1; /* trinary logic */ + dashstuff = 1; /* ternary logic */ continue; case NBITSTUFFSW: - dashstuff = -1; /* trinary logic */ + dashstuff = -1; /* ternary logic */ continue; case FROMSW: @@ -290,8 +291,7 @@ main (int argc, char **argv) if (*cp == '+' || *cp == '@') { if (folder) adios (NULL, "only one folder at a time!"); - else - folder = pluspath (cp); + folder = pluspath (cp); } else { app_msgarg(&msgs, cp); } @@ -454,11 +454,9 @@ try_it_again: if (digest) { snprintf (buf, sizeof(buf), IFORMAT, digest); - snprintf (value, sizeof(value), "%d", issue); - context_replace (buf, mh_xstrdup(value)); + context_replace (buf, mh_xstrdup(m_str(issue))); snprintf (buf, sizeof(buf), VFORMAT, digest); - snprintf (value, sizeof(value), "%d", volume); - context_replace (buf, mh_xstrdup(value)); + context_replace (buf, mh_xstrdup(m_str(volume))); } context_replace (pfolder, folder); /* update current folder */ @@ -487,7 +485,7 @@ mhl_draft (int out, char *digest, int volume, int issue, char *file, char *filter, int dashstuff) { pid_t child_id; - int i, msgnum, pd[2]; + int msgnum, pd[2]; char buf1[BUFSIZ]; char buf2[BUFSIZ]; char *program; @@ -498,9 +496,7 @@ mhl_draft (int out, char *digest, int volume, int issue, argsplit_msgarg(&vec, mhlproc, &program); - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) - sleep (5); - + child_id = fork(); switch (child_id) { case NOTOK: adios ("fork", "unable to"); @@ -545,7 +541,7 @@ mhl_draft (int out, char *digest, int volume, int issue, execvp (program, vec.msgs); fprintf (stderr, "unable to exec "); perror (mhlproc); - _exit (-1); + _exit(1); default: close (pd[1]); @@ -589,7 +585,7 @@ copy_draft (int out, char *digest, char *file, int volume, int issue, int dashst if (msgnum == mp->lowsel) { snprintf (bp, buflen, " Forwarded Message%s", - mp->numsel > 1 ? "s" : ""); + PLURALS(mp->numsel)); } else { snprintf (bp, buflen, " Message %d", msgcnt); } @@ -626,7 +622,7 @@ copy_draft (int out, char *digest, char *file, int volume, int issue, int dashst strncpy (buffer, delim4, sizeof(buffer)); } else { snprintf (buffer, sizeof(buffer), "\n------- End of Forwarded Message%s\n", - mp->numsel > 1 ? "s" : ""); + PLURALS(mp->numsel)); } if (write (out, buffer, strlen (buffer)) < 0) { advise (drft, "write"); @@ -658,7 +654,7 @@ copy_mime_draft (int out) char buffer[BUFSIZ]; snprintf (buffer, sizeof(buffer), "#forw [forwarded message%s] +%s", - mp->numsel == 1 ? "" : "s", mp->foldpath); + PLURALS(mp->numsel), mp->foldpath); if (write (out, buffer, strlen (buffer)) < 0) { advise (drft, "write"); }