-/*
- * show.c -- show/list messages
+/* show.c -- show/list 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 <h/mh.h>
#include <h/mime.h>
+#include "h/done.h"
#include <h/utils.h>
+#include "sbr/m_maildir.h"
#define SHOW_SWITCHES \
X("checkmime", 0, CHECKMIMESW) \
goto non_mhl_switches;
case NHEADSW:
headersw = 0;
+ /* FALLTHRU */
case CONCATSW:
case NCONCATSW:
non_mhl_switches:
app_msgarg(&vec, --cp);
if (!(cp = *argp++) || *cp == '-')
adios (NULL, "missing argument to %s", argp[-2]);
- app_msgarg(&vec, getcpy (etcpath(cp)));
+ app_msgarg(&vec, mh_xstrdup(etcpath(cp)));
continue;
case PROGSW:
if (*cp == '+' || *cp == '@') {
if (folder)
adios (NULL, "only one folder at a time!");
- else
- folder = pluspath (cp);
+ folder = pluspath (cp);
} else {
if (mode != SHOW)
goto usage;
if (msgs.size)
adios (NULL, "only one file at a time!");
if (draftsw)
- app_msgarg(&vec, getcpy (m_draft (folder, NULL, 1, &isdf)));
+ app_msgarg(&vec, mh_xstrdup(m_draft(folder, NULL, 1, &isdf)));
else
app_msgarg(&vec, file);
headersw = 0;
}
if (folder && !draftsw && !file)
- m_putenv ("mhfolder", folder);
+ setenv("mhfolder", folder, 1);
if (strcmp (r1bindex (proc, '/'), "cat") == 0) {
{
int result, state;
char *bp, *dp, *cp;
- char buf[BUFSIZ], name[NAMESZ];
+ char buf[NMH_BUFSIZ], name[NAMESZ];
FILE *fp;
- m_getfld_state_t gstate = 0;
+ m_getfld_state_t gstate;
if ((fp = fopen (msgnam, "r")) == NULL)
return 0;
-
+ gstate = m_getfld_state_init(fp);
for (;;) {
int bufsz = sizeof buf;
- switch (state = m_getfld (&gstate, name, buf, &bufsz, fp)) {
+ switch (state = m_getfld2(&gstate, name, buf, &bufsz)) {
case FLD:
case FLDPLUS:
/*
int passno;
char c;
- cp = add (buf, NULL);
+ cp = mh_xstrdup(buf);
while (state == FLDPLUS) {
bufsz = sizeof buf;
- state = m_getfld (&gstate, name, buf, &bufsz, fp);
+ state = m_getfld2(&gstate, name, buf, &bufsz);
cp = add (buf, cp);
}
bp = cp;
continue;
case '(':
i++;
- /* and fall... */
+ continue;
default:
continue;
case ')':
* Check Content-Transfer-Encoding field
*/
if (!strcasecmp (name, ENCODING_FIELD)) {
- cp = add (buf, NULL);
+ cp = mh_xstrdup(buf);
while (state == FLDPLUS) {
bufsz = sizeof buf;
- state = m_getfld (&gstate, name, buf, &bufsz, fp);
+ state = m_getfld2(&gstate, name, buf, &bufsz);
cp = add (buf, cp);
}
for (bp = cp; isspace ((unsigned char) *bp); bp++)
*/
while (state == FLDPLUS) {
bufsz = sizeof buf;
- state = m_getfld (&gstate, name, buf, &bufsz, fp);
+ state = m_getfld2(&gstate, name, buf, &bufsz);
}
break;