From: Ken Hornstein Date: Thu, 23 Jan 2014 18:35:31 +0000 (-0500) Subject: Merge branch 'mhbuild-always' X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/64e8827c5d5def0325ab7181fe939623c77e807c?ds=sidebyside;hp=-c Merge branch 'mhbuild-always' --- 64e8827c5d5def0325ab7181fe939623c77e807c diff --combined docs/pending-release-notes index 288b5674,8c1de2bf..b2d2a82a --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@@ -67,6 -67,11 +67,11 @@@ NEW FEATURE directive that send(1) will use. - mhbuild(1) now supports the -auto/-noauto flags (to be used by send(1) when invoking mhbuild automatically). + - mhbuild(1) now is automatically run by send, to insure that all outgoing + messages have proper MIME formatting. + - A new header, "Attach", is supported by mhbuild; it is used to replace + previous functionality (which by default used a header named + Nmh-Attachment). ----------------- OBSOLETE FEATURES @@@ -109,9 -114,6 +114,9 @@@ ap(8) commands has been removed. - "make install" no longer strips executables. Use "make install-strip" instead. +- The environment variable MM_CHARSET to indicate the native character + set is no longer supported. The native character set will be solely + determined by the locale settings. ------------------- DEPRECATED FEATURES diff --combined man/mh-profile.man index 47c59283,284d8c57..14d1c5ab --- a/man/mh-profile.man +++ b/man/mh-profile.man @@@ -156,16 -156,6 +156,6 @@@ EDITOR environment variables (profile, default: vi) .RE .PP - .BR automimeproc : - .RS 5 - If defined and set to 1, then the - .B whatnow - program will automatically - invoke the buildmimeproc (discussed below) to process each message as a MIME - composition draft before it is sent. - (profile, no default) - .RE - .PP .BR Msg\-Protect : 600 .RS 5 @@@ -783,6 -773,48 +773,6 @@@ additional user profile (file) to be re in addition to the mhn.defaults profile. .RE .PP -.B $MM_CHARSET -.RS 5 -With this environment variable, you can specify -the native character set you are using. You must be able to display -this character set on your terminal. -.PP -This variable is checked to see if a RFC 2047 header field should be -decoded (in -.BR inc , -.BR scan , -.BR mhl ). -This variable is -checked by -.B show -to see if the -.I showproc -or -.I showmimeproc -should -be called, since showmimeproc will be called if a text message uses -a character set that doesn't match -.BR $MM_CHARSET . -This variable is -checked by -.B mhshow -for matches against the charset parameter -of text contents to decide it the text content can be displayed -without modifications to your terminal. This variable is checked by -.B mhbuild -to decide what character set to specify in the charset -parameter of text contents containing 8\-bit characters. -.PP -When decoding text in such an alternate character set, -.B nmh -must be able to determine which characters are alphabetic, which -are control characters, etc. For many operating systems, this -will require enabling the support for locales (such as setting -the environment variable -.B $LC_CTYPE -to iso_8859_1). -.RE -.PP .B $MAILDROP .RS 5 This variable tells diff --combined man/mhbuild.man index 9dbf05a8,8cf59898..e4bd7933 --- a/man/mhbuild.man +++ b/man/mhbuild.man @@@ -1,4 -1,4 +1,4 @@@ - .TH MHBUILD %manext1% "March 21, 2013" "%nmhversion%" + .TH MHBUILD %manext1% "January 23, 2014" "%nmhversion%" .\" .\" %nmhwarning% .\" @@@ -21,6 -21,7 +21,7 @@@ mhbuild \- translate MIME composition d .RB [ \-headerencoding .IR encoding\-algorithm .RB " | " \-autoheaderencoding ] + .RB [ \-dist ] .RB [ \-version ] .RB [ \-help ] .ad @@@ -78,6 -79,21 +79,21 @@@ switc is present, then the listing will show any \*(lqextra\*(rq information that is present in the message, such as comments in the \*(lqContent-Type\*(rq header. + .SS "Simplified Attachment Interface" + For users who wish to simply attach files to text content, + .B mhbuild + will scan the composition file for \*(lqAttach\*(rq headers. An + \*(lqAttach\*(rq header contains a filename that will be appended to the + message using normal MIME encapsulation rules. One filename is allowed + per \*(lqAttach\*(rq header, but multiple \*(lqAttach\*(rq headers are + allowed ber composition file. + .PP + These files will be appended after any other MIME content, including any + content specified by + .B mhbuild + directives (see below). See + .IR send (1) + for more details. .SS "Translating the Composition File" .B mhbuild is essentially a filter to aid in the composition of MIME @@@ -448,9 -464,7 +464,9 @@@ If a text content contains any 8\-bit c high bit set) and the character set is not specified as above, then .B mhbuild will assume the character set is of the type given by the -environment variable MM_CHARSET. If this environment variable is not +standard +.IR locale (1) +environment variables. If these environment variables are not set, then the character set will be labeled as \*(lqx-unknown\*(rq. .PP If a text content contains only 7\-bit characters and the character set @@@ -555,20 -569,11 +571,11 @@@ on file that already in MIME format. T switch will cause .B mhbuild to exit without error if the input file already has valid MIME headers. - .PP - It is also possible to have the - .B whatnow - program invoke - .B mhbuild - automatically when a message is sent. To do this, you must add the line - .PP - .RS 5 - automimeproc: 1 - .RE - .PP - to your - .I \&.mh\(ruprofile - file. + The use of + .B \-auto + also enables the + .B \-nodirectives + switch. .PP Finally, you should consider adding this line to your profile: .PP @@@ -587,6 -592,14 +594,14 @@@ What now? lis .RE .PP will work as you expect. + .PP + The + .B \-dist + switch is intended to be used by + .BR dist . + It will cause mhbuild to not generate any MIME headers in the composition + file (such as \*(lqMIME-Version\*(rq or \*(lqContent-Type\*(rq), but it + will still encode message headers according to RFC 2047. .SS "User Environment" Because the environment in which .B mhbuild diff --combined uip/mhbuild.c index 0af3c56f,681c4fe8..85b5a21b --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@@ -44,6 -44,7 +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 +104,7 @@@ int list_all_messages (CT *, 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; @@@ -115,7 -116,9 +116,7 @@@ done=unlink_done; -#ifdef LOCALE setlocale(LC_ALL, ""); -#endif invo_name = r1bindex (argv[0], '/'); /* read user profile/context */ @@@ -268,6 -271,9 +269,9 @@@ case DEBUGSW: debugsw = 1; continue; + case DISTSW: + dist = 1; + continue; } } if (compfile) @@@ -334,7 -340,7 +338,7 @@@ 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 @@@ -364,7 -370,7 +368,7 @@@ */ /* 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 --combined uip/send.c index be5dc793,3ba82fb5..626eba16 --- a/uip/send.c +++ b/uip/send.c @@@ -62,8 -62,8 +62,8 @@@ X("saslmaxssf", SASLminc(-10), SASLMXSSFSW) \ X("saslmech mechanism", SASLminc(-5), SASLMECHSW) \ X("user username", SASLminc(-4), USERSW) \ - X("attach", 6, ATTACHSW) \ - X("noattach", 0, NOATTACHSW) \ + X("attach", -6, ATTACHSW) \ + X("noattach", -8, NOATTACHSW) \ X("attachformat", 7, ATTACHFORMATSW) \ X("port server-port-name/number", 4, PORTSW) \ X("tls", TLSminc(-3), TLSSW) \ @@@ -117,10 -117,10 +117,8 @@@ main (int argc, char **argv char *msgs[MAXARGS], **vec; struct msgs *mp; struct stat st; - char *attach = NMH_ATTACH_HEADER; /* header field name for attachments */ - int attachformat = 1; /* mhbuild format specifier for attachments */ -#ifdef LOCALE setlocale(LC_ALL, ""); -#endif invo_name = r1bindex (argv[0], '/'); /* read user profile/context */ @@@ -271,26 -271,14 +269,14 @@@ continue; case ATTACHSW: - if (!(attach = *argp++) || *attach == '-') - adios (NULL, "missing argument to %s", argp[-2]); + advise(NULL, "The -attach switch is deprecated"); continue; case NOATTACHSW: - attach = NULL; + advise(NULL, "The -noattach switch is deprecated"); continue; case ATTACHFORMATSW: - 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; + advise(NULL, "The -attachformat switch is deprecated"); continue; } } else { @@@ -438,8 -426,7 +424,7 @@@ go_to_it closefds (3); for (msgnum = 0; msgnum < msgp; msgnum++) { - switch (sendsbr (vec, vecp, program, msgs[msgnum], &st, 1, attach, - attachformat)) { + switch (sendsbr (vec, vecp, program, msgs[msgnum], &st, 1)) { case DONE: done (++status); case NOTOK: diff --combined uip/viamail.c index 39ccf509,e0143992..13447382 --- a/uip/viamail.c +++ b/uip/viamail.c @@@ -54,16 -54,15 +54,13 @@@ main (int argc, char **argv int delay = 0; char *f1 = NULL, *f2 = NULL, *f3 = NULL; char *f4 = NULL, *f5 = NULL, *f7 = NULL; - static char postpath[PATH_MAX]; char *cp, buf[BUFSIZ]; char **argp, **arguments; -#ifdef LOCALE setlocale(LC_ALL, ""); -#endif invo_name = r1bindex (argv[0], '/'); - /* foil search of user profile/context */ - if (context_foil (NULL) == -1) - done (1); + context_read(); arguments = getarguments (invo_name, argc, argv, 0); argp = arguments; @@@ -138,34 -137,6 +135,6 @@@ if (!f1) adios (NULL, "missing -viamail \"mailpath\" switch"); - /* viamail doesn't read the context and postproc isn't always what - we want, such as when running make distcheck. If we have the - absolute path, set postproc to point to post in the same - directory as this executable. - This could be generalized to handle relative paths (by - converting to absolute), to find the full path from PATH given - just the basename, and to squash out ../ but it's only needed - here. viamail is typically called from sendfiles, which - provides the absolute path. - */ - if (argv[0] && argv[0][0] == '/' && - strlen(argv[0]) - 3 < sizeof postpath) { - strncpy (postpath, argv[0], sizeof postpath - 1); - postpath[sizeof postpath - 1] = '\0'; - if ((cp = strrchr (postpath, '/'))) { - struct stat st; - - *(cp + 1) = '\0'; - /* strlen ("post") <= sizeof postpath - (cp - postpath) - 2 - but use strncat just in case the code above changes. */ - strncat (postpath, "post", sizeof postpath - (cp - postpath) - 2); - - if (stat (postpath, &st) == OK) { - postproc = postpath; - } - } - } - via_mail (f1, f2, f3, f4, f5, delay, f7); return 0; /* dead code to satisfy the compiler */ } @@@ -248,7 -219,7 +217,7 @@@ via_mail (char *mailsw, char *subjsw, c vec[vecp++] = cp; } - switch (sendsbr (vec, vecp, program, tmpfil, &st, 0, (char *)0, 0)) { + switch (sendsbr (vec, vecp, program, tmpfil, &st, 0)) { case DONE: case NOTOK: status++;