]> diplodocus.org Git - nmh/blobdiff - uip/whatnowsbr.c
Add more NORETURN and CHECK_PRINTF function attributes.
[nmh] / uip / whatnowsbr.c
index aba965b41e738edf84d00a5f3954a3ff7ae33afa..fe1b2f7ec11752b9fb84f7cc567b96f5772f131e 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * whatnowsbr.c -- the WhatNow shell
+/* whatnowsbr.c -- the WhatNow shell
  *
  * 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/mime.h>
 #include <h/utils.h>
-
 #ifdef OAUTH_SUPPORT
 # include <h/oauth.h>
 #endif
+#include "../sbr/m_maildir.h"
+#include "../sbr/m_mktemp.h"
+#include "../sbr/mime_type.h"
 
 #define WHATNOW_SWITCHES \
     X("draftfolder +folder", 0, DFOLDSW) \
@@ -198,8 +199,7 @@ WhatNow (int argc, char **argv)
        }
        if (drft)
            adios (NULL, "only one draft at a time!");
-       else
-           drft = cp;
+        drft = cp;
     }
 
     if ((drft == NULL && (drft = getenv ("mhdraft")) == NULL) || *drft == 0)
@@ -707,8 +707,8 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
            }
            if (altmsg) {
                if (mp)
-                   m_putenv ("mhfolder", mp->foldpath);
-               m_putenv ("editalt", altpath);
+                   setenv("mhfolder", mp->foldpath, 1);
+               setenv("editalt", altpath, 1);
            }
 
            vec = argsplit(*ed, &prog, &vecp);
@@ -1173,7 +1173,7 @@ sendit (char *sp, char **arg, char *file, int pushed)
                        inform("missing argument to %s", argp[-2]);
                        return;
                    }
-                   /* FALLTHRU */
+                   continue;
                case SNDRFSW:
                    continue;
            }
@@ -1195,7 +1195,7 @@ sendit (char *sp, char **arg, char *file, int pushed)
 
     if ((cp = getenv ("SIGNATURE")) == NULL || *cp == 0)
        if ((cp = context_find ("signature")) && *cp)
-           m_putenv ("SIGNATURE", cp);
+           setenv("SIGNATURE", cp, 1);
 
     if ((annotext = getenv ("mhannotate")) == NULL || *annotext == 0)
        annotext = NULL;
@@ -1311,8 +1311,8 @@ static int
 checkmimeheader (char *drft)
 {
     FILE *f;
-    m_getfld_state_t gstate = 0;
-    char buf[BUFSIZ], name[NAMESZ];
+    m_getfld_state_t gstate;
+    char buf[NMH_BUFSIZ], name[NAMESZ];
     int state, retval = 0;
 
     if ((f = fopen(drft, "r")) == NULL) {
@@ -1320,9 +1320,10 @@ checkmimeheader (char *drft)
        return (0);
     }
 
+    gstate = m_getfld_state_init(f);
     for (;;) {
        int bufsz = sizeof(buf);
-       switch (state = m_getfld(&gstate, name, buf, &bufsz, f)) {
+       switch (state = m_getfld2(&gstate, name, buf, &bufsz)) {
        case FLD:
        case FLDPLUS:
            if (strcasecmp(name, VRSN_FIELD) == 0) {