X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/77bd4fc7347961a3436393f4de70b0acca475ecc..e35fb433:/uip/whatnowsbr.c?ds=sidebyside diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index 68c534eb..72b315f4 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -1,6 +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 @@ -43,10 +41,12 @@ #include #include #include - #ifdef OAUTH_SUPPORT # include #endif +#include "sbr/m_maildir.h" +#include "sbr/m_mktemp.h" +#include "sbr/mime_type.h" #define WHATNOW_SWITCHES \ X("draftfolder +folder", 0, DFOLDSW) \ @@ -199,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) @@ -708,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); @@ -802,7 +801,7 @@ static int sendfile (char **arg, char *file, int pushsw) { pid_t child_id; - int i, vecp; + int vecp; char *cp, *sp, **vec, *program; /* @@ -819,8 +818,7 @@ sendfile (char **arg, char *file, int pushsw) context_save (); /* save the context file */ fflush (stdout); - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) - sleep (5); + child_id = fork(); switch (child_id) { case NOTOK: inform("unable to fork, so sending directly..."); @@ -1174,7 +1172,7 @@ sendit (char *sp, char **arg, char *file, int pushed) inform("missing argument to %s", argp[-2]); return; } - /* FALLTHRU */ + continue; case SNDRFSW: continue; } @@ -1196,7 +1194,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; @@ -1312,8 +1310,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) { @@ -1321,9 +1319,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) {