X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fwhatnowsbr.c;h=0a959db2bc27151f2e1ca4fc0ff425338688d458;hb=ac33b2e9c3632537b93fc4755a925c682d1eb82e;hp=53320d32520365921c20fc0050773dbe69739ea9;hpb=7480dbc14bc90f2d872d434205c0784704213252;p=mmh diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index 53320d3..0a959db 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -44,6 +44,7 @@ #include #include #include +#include static struct swit whatnowswitches[] = { #define DFOLDSW 0 @@ -447,10 +448,10 @@ WhatNow (int argc, char **argv) *(strchr(shell, '\n')) = '\0'; if (*shell == '/') - (void)annotate(drft, attach, shell, 1, 0, -1, 1); + (void)annotate(drft, attach, shell, 1, 0, -2, 1); else { (void)sprintf(file, "%s/%s", cwd, shell); - (void)annotate(drft, attach, file, 1, 0, -1, 1); + (void)annotate(drft, attach, file, 1, 0, -2, 1); } } @@ -843,8 +844,7 @@ buildfile (char **argp, char *file) while (argp[i]) i++; } - if ((args = (char **) malloc((i + 2) * sizeof(char *))) == NULL) - adios (NULL, "unable to malloc memory"); + args = (char **) mh_xmalloc((i + 2) * sizeof(char *)); /* * For backward compatibility, we need to add -build @@ -1005,6 +1005,8 @@ static struct swit sendswitches[] = { { "user", SASLminc(-4) }, #define SNDATTACHSW 39 { "attach file", 6 }, +#define SNDATTACHFORMAT 40 + { "attachformat", 7 }, { NULL, 0 } }; @@ -1030,6 +1032,8 @@ sendit (char *sp, char **arg, char *file, int pushed) char **arguments, *vec[MAXARGS]; struct stat st; char *attach = (char *)0; /* attachment header field name */ + int attachformat = 0; /* mhbuild format specifier for + attachments */ #ifndef lint int distsw = 0; @@ -1190,6 +1194,21 @@ sendit (char *sp, char **arg, char *file, int pushed) return; } continue; + + case SNDATTACHFORMAT: + if (! *argp || **argp == '-') + adios (NULL, "missing argument to %s", argp[-1]); + else { + attachformat = atoi (*argp); + if (attachformat < 0 || + attachformat > ATTACHFORMATS - 1) { + advise (NULL, "unsupported attachformat %d", + attachformat); + continue; + } + } + ++argp; + continue; } } advise (NULL, "usage: %s [switches]", sp); @@ -1255,7 +1274,7 @@ sendit (char *sp, char **arg, char *file, int pushed) vec[0] = r1bindex (postproc, '/'); closefds (3); - if (sendsbr (vec, vecp, file, &st, 1, attach) == OK) + if (sendsbr (vec, vecp, file, &st, 1, attach, attachformat) == OK) done (0); }