-
-/*
- * 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
#include <fcntl.h>
#include <h/tws.h>
#include <h/utils.h>
+#include "../sbr/m_maildir.h"
#define IFORMAT "digest-issue-%s"
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) \
nwhat = 0;
continue;
case BILDSW:
- buildsw++; /* fall... */
+ buildsw++;
+ /* FALLTHRU */
case NWHATSW:
nwhat++;
continue;
case DGSTSW:
if (!(cp = *argp++) || *cp == '-')
adios (NULL, "missing argument to %s", argp[-2]);
- digest = getcpy(cp);
+ digest = mh_xstrdup(cp);
mime = 0;
continue;
case ISSUESW:
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:
case SUBJECTSW:
if (!(cp = *argp++) || *cp == '-')
adios (NULL, "missing argument to %s", argp[-2]);
- subject = getcpy(cp);
+ subject = mh_xstrdup(cp);
continue;
case WIDTHSW:
}
}
- cwd = getcpy (pwd ());
+ cwd = mh_xstrdup(pwd ());
if (!context_find ("path"))
free (path ("./", TFOLDER));
i = YESW;
break;
default:
- advise (NULL, "say what?");
+ inform("say what?");
break;
}
}
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
if (is_selected (mp, msgnum)) {
- fwdmsg = strdup(m_name(msgnum));
+ fwdmsg = mh_xstrdup(m_name(msgnum));
break;
}
if (digest) {
snprintf (buf, sizeof(buf), IFORMAT, digest);
snprintf (value, sizeof(value), "%d", issue);
- context_replace (buf, getcpy (value));
+ context_replace (buf, mh_xstrdup(value));
snprintf (buf, sizeof(buf), VFORMAT, digest);
snprintf (value, sizeof(value), "%d", volume);
- context_replace (buf, getcpy (value));
+ context_replace (buf, mh_xstrdup(value));
}
context_replace (pfolder, folder); /* update current folder */
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
if (is_selected (mp, msgnum))
- app_msgarg(&vec, getcpy (m_name (msgnum)));
+ app_msgarg(&vec, mh_xstrdup(m_name (msgnum)));
}
app_msgarg(&vec, NULL);
if (msgnum == mp->lowsel) {
snprintf (bp, buflen, " Forwarded Message%s",
- mp->numsel > 1 ? "s" : "");
+ PLURALS(mp->numsel));
} else {
snprintf (bp, buflen, " Message %d", msgcnt);
}
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");
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");
}