From: Ken Hornstein Date: Fri, 16 Mar 2012 17:02:43 +0000 (-0400) Subject: Make -attach Nmh-Attachment & -attachformat 1 the default. X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=a66c30d557c09799db7cd166ba5fa2a97dbafbb3;p=mmh Make -attach Nmh-Attachment & -attachformat 1 the default. --- diff --git a/docs/pending-release-notes b/docs/pending-release-notes index 00fc444..041cd28 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -48,3 +48,5 @@ Things to add to the release notes for the next full release: [Bug #35303]. - post(8) can now explicitly control the SMTP envelope address either via the Sender: header or the new Envelope-From: header. +- The -attach option is now the default (using Nmh-Attachment) and + -attachformat 1 is now the default. diff --git a/h/mh.h b/h/mh.h index adb3303..1d55618 100644 --- a/h/mh.h +++ b/h/mh.h @@ -266,6 +266,8 @@ extern char *msg_delim; /* .. */ #define LINK "@" /* Name of link to file to which you are */ /* replying. */ +#define NMH_ATTACH_HEADER "Nmh-Attachment" /* Default header for -attach */ + /* * miscellaneous macros */ diff --git a/man/send.man b/man/send.man index 2cd840b..0f08c5d 100644 --- a/man/send.man +++ b/man/send.man @@ -51,6 +51,7 @@ send \- send a message .RB [ \-help ] .RB [ \-attach .IR header-field-name ] +.RB [ \-noattach ] .RB [ \-attachformat .IR 0 " | " 1 " | " 2 ] .ad @@ -78,15 +79,15 @@ are actually performed by .BR post . .PP -If a -.I header-field-name -is supplied using the -.B -attach -option, the draft is scanned for a header whose field name matches the -supplied -.IR header-field-name . +By default the draft is scanned for a header named +.IR Nmh-Attachment . The draft is converted to a MIME message if one or more matches are found. -This conversion occurs before all other processing. +This conversion occurs before all other processing. The header name +can be changed with the +.B \-attach +option. This behavior can be disabled completely with the +.B \-noattach +option. .PP The first part of the MIME message is the draft body if that body contains any non-blank characters. @@ -115,12 +116,12 @@ command on the file. The .B -attachformat option specifies the MIME header field formats: a value of -.B 0, -the default, +.B 0 includes the .I x-unix-mode attribute as noted above. A value of -.B 1 +.BR 1 , +the default, suppresses that, puts the file name in the \*(lqContent-Description\*(rq header, and adds a \*(lqContent-Disposition\*(rq header. A value of @@ -440,7 +441,8 @@ comp(1), dist(1), forw(1), repl(1), mh\-alias(5), post(8) .RB ` \-noverbose ' .RB ` \-nowatch ' .RB ` "\-width\ 72" ' -.RB ` "\-attachformat\ 0" ' +.RB ` "\-attach\ Nmh-Attachment" ' +.RB ` "\-attachformat\ 1" ' .fi .SH CONTEXT diff --git a/man/whatnow.man b/man/whatnow.man index 749e548..1b4c2f2 100644 --- a/man/whatnow.man +++ b/man/whatnow.man @@ -23,6 +23,7 @@ whatnow \- prompting front-end for sending messages .RB [ \-help ] .RB [ \-attach .IR header-field-name ] +.RB [ \-noattach ] .ad .SH DESCRIPTION .B Whatnow @@ -230,6 +231,7 @@ send(1), whom(1) .SH DEFAULTS .nf .RB ` \-prompt "' defaults to \*(lqWhat\ Now?\ \*(rq" +.RB ` \-attach "' defaults to \*(lqNmh-Attachment\*(rq" .fi .SH CONTEXT diff --git a/uip/send.c b/uip/send.c index 9df71d7..5034121 100644 --- a/uip/send.c +++ b/uip/send.c @@ -112,13 +112,15 @@ static struct swit switches[] = { { "user username", SASLminc(-4) }, #define ATTACHSW 42 { "attach", 6 }, -#define ATTACHFORMATSW 43 +#define NOATTACHSW 43 + { "noattach", 0 }, +#define ATTACHFORMATSW 44 { "attachformat", 7 }, -#define PORTSW 44 +#define PORTSW 45 { "port server-port-name/number" , 4 }, -#define TLSSW 45 +#define TLSSW 46 { "tls", TLSminc(-3) }, -#define NTLSSW 46 +#define NTLSSW 47 { "notls", TLSminc(-5) }, { NULL, 0 } }; @@ -157,8 +159,8 @@ main (int argc, char **argv) char *msgs[MAXARGS], *vec[MAXARGS]; struct msgs *mp; struct stat st; - char *attach = (char *)0; /* header field name for attachments */ - int attachformat = 0; /* mhbuild format specifier for attachments */ + char *attach = NMH_ATTACH_HEADER; /* header field name for attachments */ + int attachformat = 1; /* mhbuild format specifier for attachments */ #ifdef LOCALE setlocale(LC_ALL, ""); @@ -309,6 +311,9 @@ main (int argc, char **argv) if (!(attach = *argp++) || *attach == '-') adios (NULL, "missing argument to %s", argp[-2]); continue; + case NOATTACHSW: + attach = NULL; + continue; case ATTACHFORMATSW: if (! *argp || **argp == '-') diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index 58099f0..d23d141 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -63,6 +63,8 @@ static struct swit whatnowswitches[] = { { "help", 0 }, #define ATTACHSW 8 { "attach header-field-name", 0 }, +#define NOATTACHSW 9 + { "noattach", 0 }, { NULL, 0 } }; @@ -138,7 +140,7 @@ WhatNow (int argc, char **argv) char buf[BUFSIZ], prompt[BUFSIZ]; char **argp, **arguments; struct stat st; - char *attach = (char *)0; /* attachment header field name */ + char *attach = NMH_ATTACH_HEADER;/* attachment header field name */ char cwd[MAXPATHLEN + 1]; /* current working directory */ char file[MAXPATHLEN + 1]; /* file name buffer */ char shell[MAXPATHLEN + 1]; /* shell response buffer */ @@ -213,11 +215,13 @@ WhatNow (int argc, char **argv) continue; case ATTACHSW: - if (attach != (char *)0) - adios(NULL, "only one attachment header field name at a time!"); if (!(attach = *argp++) || *attach == '-') adios (NULL, "missing argument to %s", argp[-2]); continue; + + case NOATTACHSW: + attach = NULL; + continue; } } if (drft) @@ -1064,13 +1068,15 @@ static struct swit sendswitches[] = { { "user", SASLminc(-4) }, #define SNDATTACHSW 41 { "attach file", 6 }, -#define SNDATTACHFORMAT 42 +#define SNDNOATTACHSW 42 + { "noattach", 0 }, +#define SNDATTACHFORMAT 43 { "attachformat", 7 }, -#define PORTSW 43 +#define PORTSW 44 { "port server-port-name/number", 4 }, -#define TLSSW 44 +#define TLSSW 45 { "tls", TLSminc(-3) }, -#define NTLSSW 45 +#define NTLSSW 46 { "notls", TLSminc(-5) }, { NULL, 0 } }; @@ -1096,8 +1102,8 @@ sendit (char *sp, char **arg, char *file, int pushed) char *cp, buf[BUFSIZ], **argp; char **arguments, *vec[MAXARGS]; struct stat st; - char *attach = (char *)0; /* attachment header field name */ - int attachformat = 0; /* mhbuild format specifier for + char *attach = NMH_ATTACH_HEADER;/* attachment header field name */ + int attachformat = 1; /* mhbuild format specifier for attachments */ #ifndef lint @@ -1271,6 +1277,9 @@ sendit (char *sp, char **arg, char *file, int pushed) return; } continue; + case SNDNOATTACHSW: + attach = NULL; + continue; case SNDATTACHFORMAT: if (! *argp || **argp == '-')