]> diplodocus.org Git - nmh/blobdiff - uip/mhfixmsg.c
Add gcc's malloc function attribute.
[nmh] / uip / mhfixmsg.c
index cef8593f717793ba8ccb83c6121b6acd2a124196..88dfb153b9c7ba6e1f78dd6a4f08c545ea5898b4 100644 (file)
@@ -11,7 +11,9 @@
 #include <h/mhparse.h>
 #include <h/utils.h>
 #include <h/signals.h>
 #include <h/mhparse.h>
 #include <h/utils.h>
 #include <h/signals.h>
+#include "../sbr/m_maildir.h"
 #include "../sbr/m_mktemp.h"
 #include "../sbr/m_mktemp.h"
+#include "../sbr/mime_type.h"
 #include "mhfree.h"
 #include "mhoutsbr.h"
 #include "mhshowsbr.h"
 #include "mhfree.h"
 #include "mhoutsbr.h"
 #include "mhshowsbr.h"
@@ -123,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 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);
 
 
 static void pipeser (int);
 
 
@@ -230,11 +233,10 @@ main (int argc, char **argv) {
                     adios (NULL, "missing argument to %s", argp[-2]);
                 }
                 if (! strncasecmp (cp, "multipart/", 10)  ||
                     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);
                     adios (NULL, "-fixtype %s not allowed", cp);
-                } else if (! strchr (cp, '/')) {
+                if (! strchr (cp, '/'))
                     adios (NULL, "-fixtype requires type/subtype");
                     adios (NULL, "-fixtype requires type/subtype");
-                }
                 if (fx.fixtypes == NULL) { fx.fixtypes = svector_create (10); }
                 svector_push_back (fx.fixtypes, cp);
                 continue;
                 if (fx.fixtypes == NULL) { fx.fixtypes = svector_create (10); }
                 svector_push_back (fx.fixtypes, cp);
                 continue;
@@ -285,11 +287,9 @@ main (int argc, char **argv) {
             }
         }
         if (*cp == '+' || *cp == '@') {
             }
         }
         if (*cp == '+' || *cp == '@') {
-            if (folder) {
+            if (folder)
                 adios (NULL, "only one folder at a time!");
                 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. */
         } else {
             if (*cp == '/') {
                 /* Interpret a full path as a filename, not a message. */
@@ -816,7 +816,7 @@ replace_boundary (CT ct, char *file, char *boundary) {
     int compnum, state;
     char buf[NMH_BUFSIZ], name[NAMESZ];
     char *np, *vp;
     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) {
     int status = OK;
 
     if (ct->c_file == NULL) {
@@ -835,10 +835,11 @@ replace_boundary (CT ct, char *file, char *boundary) {
         return NOTOK;
     }
 
         return NOTOK;
     }
 
+    gstate = m_getfld_state_init(fpin);
     for (compnum = 1;;) {
         int bufsz = (int) sizeof buf;
 
     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++;
         case FLD:
         case FLDPLUS:
             compnum++;
@@ -850,7 +851,7 @@ replace_boundary (CT ct, char *file, char *boundary) {
             /* if necessary, get rest of field */
             while (state == FLDPLUS) {
                 bufsz = sizeof buf;
             /* 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 */
             }
 
                 vp = add (buf, vp);     /* add to previous value */
             }