From: Ken Hornstein Date: Sun, 19 Jan 2014 06:11:59 +0000 (-0500) Subject: Add support for not outputting any MIME headers when using dist. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/fbc0e57bf904a7f727cb6e02b24916c0125341c1?hp=ee04f1033a5dfd6a7949ae644d6c3ed689ad84b8 Add support for not outputting any MIME headers when using dist. --- diff --git a/h/mhparse.h b/h/mhparse.h index 62e6c0b3..29fc1afe 100644 --- a/h/mhparse.h +++ b/h/mhparse.h @@ -296,6 +296,9 @@ CT parse_mime (char *); * that the composition file is already in MIME format * and will not be processed further. Otherwise, an * error is generated. + * dist - A flag to indicate if we are being run by "dist". In + * that case, add no MIME headers to the message. Existing + * headers will still be encoded by RFC 2047. * directives - A flag to control whether or not build directives are * processed by default. * encoding - The default encoding to use when doing RFC 2047 header @@ -306,7 +309,8 @@ CT parse_mime (char *); * -auto flag is set and a MIME-Version header is encountered, the return * value is NULL. */ -CT build_mime (char *infile, int autobuild, int directives, int encoding); +CT build_mime (char *infile, int autobuild, int dist, int directives, + int encoding); int add_header (CT, char *, char *); int get_ctinfo (char *, CT, int); diff --git a/uip/mhbuild.c b/uip/mhbuild.c index 18844b56..681c4fe8 100644 --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@ -44,6 +44,7 @@ X("version", 0, VERSIONSW) \ X("help", 0, HELPSW) \ X("debug", -5, DEBUGSW) \ + X("dist", -4, DISTSW) \ #define X(sw, minchars, id) id, DEFINE_SWITCH_ENUM(MHBUILD); @@ -103,7 +104,7 @@ int list_all_messages (CT *, int, int, int, int); int main (int argc, char **argv) { - int sizesw = 1, headsw = 1, directives = 1, autobuild = 0; + int sizesw = 1, headsw = 1, directives = 1, autobuild = 0, dist = 0; int *icachesw; char *cp, buf[BUFSIZ]; char buffer[BUFSIZ], *compfile = NULL; @@ -270,6 +271,9 @@ main (int argc, char **argv) case DEBUGSW: debugsw = 1; continue; + case DISTSW: + dist = 1; + continue; } } if (compfile) @@ -336,7 +340,7 @@ main (int argc, char **argv) unlink_infile = 1; /* build the content structures for MIME message */ - ct = build_mime (infile, autobuild, directives, header_encoding); + ct = build_mime (infile, autobuild, dist, directives, header_encoding); /* * If ct == NULL, that means that -auto was set and a MIME version @@ -366,7 +370,7 @@ main (int argc, char **argv) */ /* build the content structures for MIME message */ - ct = build_mime (compfile, autobuild, directives, header_encoding); + ct = build_mime (compfile, autobuild, dist, directives, header_encoding); /* * If ct == NULL, that means -auto was set and we found a MIME version diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 3cb5f5a6..840f0467 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -129,7 +129,8 @@ static void directive_pop(void) */ CT -build_mime (char *infile, int autobuild, int directives, int header_encoding) +build_mime (char *infile, int autobuild, int dist, int directives, + int header_encoding) { int compnum, state; char buf[BUFSIZ], name[NAMESZ]; @@ -283,9 +284,12 @@ finish_field: * Now add the MIME-Version header field * to the list of header fields. */ - np = add (VRSN_FIELD, NULL); - vp = concat (" ", VRSN_VALUE, "\n", NULL); - add_header (ct, np, vp); + + if (! dist) { + np = add (VRSN_FIELD, NULL); + vp = concat (" ", VRSN_VALUE, "\n", NULL); + add_header (ct, np, vp); + } /* * We initally assume we will find multiple contents in the @@ -461,7 +465,8 @@ finish_field: } /* Build the rest of the header field structures */ - build_headers (ct); + if (! dist) + build_headers (ct); return ct; } diff --git a/uip/sendsbr.c b/uip/sendsbr.c index c90b88b7..fd80a0f0 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -74,6 +74,8 @@ sendsbr (char **vec, int vecp, char *program, char *drft, struct stat *st, case OK: buildvec = argsplit(buildmimeproc, &buildprogram, &i); buildvec[i++] = "-auto"; + if (distfile) + buildvec[i++] = "-dist"; buildvec[i++] = drft; buildvec[i] = NULL; execvp(buildprogram, buildvec);