X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/a30ef3465250ae21bb3928a6e120ba4351cf8ff0..532fff590b4cfbfbd0633d6b58ca1ab0fec2777d:/uip/mhfixmsg.c?ds=inline diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index 549cffe9..88dfb153 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -6,13 +6,17 @@ */ #include +#include #include #include #include #include +#include "../sbr/m_maildir.h" #include "../sbr/m_mktemp.h" +#include "../sbr/mime_type.h" #include "mhfree.h" #include "mhoutsbr.h" +#include "mhshowsbr.h" #include #define MHFIXMSG_SWITCHES \ @@ -121,7 +125,8 @@ static int fix_filename_encoding (CT); static int write_content (CT, const char *, char *, FILE *, int, int); static void set_text_ctparams(CT, char *, int); static int remove_file (const char *); -static void report (char *, char *, char *, char *, ...); +static void report (char *, char *, char *, char *, ...) + CHECK_PRINTF(4, 5); static void pipeser (int); @@ -228,11 +233,10 @@ main (int argc, char **argv) { adios (NULL, "missing argument to %s", argp[-2]); } if (! strncasecmp (cp, "multipart/", 10) || - ! strncasecmp (cp, "message/", 8)) { + ! strncasecmp (cp, "message/", 8)) adios (NULL, "-fixtype %s not allowed", cp); - } else if (! strchr (cp, '/')) { + if (! strchr (cp, '/')) adios (NULL, "-fixtype requires type/subtype"); - } if (fx.fixtypes == NULL) { fx.fixtypes = svector_create (10); } svector_push_back (fx.fixtypes, cp); continue; @@ -283,11 +287,9 @@ main (int argc, char **argv) { } } if (*cp == '+' || *cp == '@') { - if (folder) { + if (folder) adios (NULL, "only one folder at a time!"); - } else { - folder = pluspath (cp); - } + folder = pluspath (cp); } else { if (*cp == '/') { /* Interpret a full path as a filename, not a message. */ @@ -814,7 +816,7 @@ replace_boundary (CT ct, char *file, char *boundary) { int compnum, state; char buf[NMH_BUFSIZ], name[NAMESZ]; char *np, *vp; - m_getfld_state_t gstate = 0; + m_getfld_state_t gstate; int status = OK; if (ct->c_file == NULL) { @@ -833,10 +835,11 @@ replace_boundary (CT ct, char *file, char *boundary) { return NOTOK; } + gstate = m_getfld_state_init(fpin); for (compnum = 1;;) { int bufsz = (int) sizeof buf; - switch (state = m_getfld (&gstate, name, buf, &bufsz, fpin)) { + switch (state = m_getfld2(&gstate, name, buf, &bufsz)) { case FLD: case FLDPLUS: compnum++; @@ -848,7 +851,7 @@ replace_boundary (CT ct, char *file, char *boundary) { /* if necessary, get rest of field */ while (state == FLDPLUS) { bufsz = sizeof buf; - state = m_getfld (&gstate, name, buf, &bufsz, fpin); + state = m_getfld2(&gstate, name, buf, &bufsz); vp = add (buf, vp); /* add to previous value */ }