]> diplodocus.org Git - nmh/blobdiff - uip/forw.c
Replaced snprintf() to convert an int with m_name().
[nmh] / uip / forw.c
index 50e14bbb5b9c42f763e1376d5f2a4c5dcc964124..331be16bb9b2e0ac5324057e54964d142876305e 100644 (file)
@@ -1,6 +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
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -11,6 +9,7 @@
 #include <fcntl.h>
 #include <h/tws.h>
 #include <h/utils.h>
 #include <fcntl.h>
 #include <h/tws.h>
 #include <h/utils.h>
+#include "../sbr/m_maildir.h"
 
 
 #define        IFORMAT "digest-issue-%s"
 
 
 #define        IFORMAT "digest-issue-%s"
@@ -41,7 +40,7 @@
     X("nodashstuffing", 0, NBITSTUFFSW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     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) \
     X("build", 5, BILDSW)                     /* interface from mhe */ \
     X("from address", 0, FROMSW) \
     X("to address", 0, TOSW) \
@@ -112,7 +111,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 *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 };
     char **argp, **arguments;
     struct stat st;
     struct msgs_array msgs = { 0, 0, NULL };
@@ -248,10 +247,10 @@ main (int argc, char **argv)
                    continue;
 
                case BITSTUFFSW: 
                    continue;
 
                case BITSTUFFSW: 
-                   dashstuff = 1;      /* trinary logic */
+                   dashstuff = 1;      /* ternary logic */
                    continue;
                case NBITSTUFFSW: 
                    continue;
                case NBITSTUFFSW: 
-                   dashstuff = -1;     /* trinary logic */
+                   dashstuff = -1;     /* ternary logic */
                    continue;
 
                case FROMSW:
                    continue;
 
                case FROMSW:
@@ -455,11 +454,9 @@ try_it_again:
 
        if (digest) {
            snprintf (buf, sizeof(buf), IFORMAT, digest);
 
        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_name(issue)));
            snprintf (buf, sizeof(buf), VFORMAT, digest);
            snprintf (buf, sizeof(buf), VFORMAT, digest);
-           snprintf (value, sizeof(value), "%d", volume);
-           context_replace (buf, mh_xstrdup(value));
+           context_replace (buf, mh_xstrdup(m_name(volume)));
        }
 
        context_replace (pfolder, folder);      /* update current folder   */
        }
 
        context_replace (pfolder, folder);      /* update current folder   */
@@ -590,7 +587,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",
 
                if (msgnum == mp->lowsel) {
                    snprintf (bp, buflen, " Forwarded Message%s",
-                       mp->numsel > 1 ? "s" : "");
+                       PLURALS(mp->numsel));
                } else {
                    snprintf (bp, buflen, " Message %d", msgcnt);
                }
                } else {
                    snprintf (bp, buflen, " Message %d", msgcnt);
                }
@@ -627,7 +624,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",
        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");
     }
     if (write (out, buffer, strlen (buffer)) < 0) {
        advise (drft, "write");
@@ -659,7 +656,7 @@ copy_mime_draft (int out)
     char buffer[BUFSIZ];
 
     snprintf (buffer, sizeof(buffer), "#forw [forwarded message%s] +%s",
     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");
     }
     if (write (out, buffer, strlen (buffer)) < 0) {
        advise (drft, "write");
     }