]> diplodocus.org Git - nmh/commitdiff
Merge branch 'mhbuild-always'
authorKen Hornstein <kenh@pobox.com>
Thu, 23 Jan 2014 18:35:31 +0000 (13:35 -0500)
committerKen Hornstein <kenh@pobox.com>
Thu, 23 Jan 2014 18:35:31 +0000 (13:35 -0500)
1  2 
docs/pending-release-notes
man/mh-profile.man
man/mhbuild.man
uip/mhbuild.c
uip/send.c
uip/viamail.c

index 288b5674efdcad4ef0ff2d7cf26f9403792d8a57,8c1de2bf831409a120a76d24f0dadd3502fe8eda..b2d2a82a006aa3a26f12145b3df53aea4006ee90
@@@ -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
    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 47c592830ff99e9b4f40b9bd6c8d318769dbe1cb,284d8c57113abce6a50a39e699e72e61d500030e..14d1c5ab59c2949bf7c7167ba8778ec5e43d3b2e
@@@ -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 9dbf05a8b40e7fc86d7dc17a61d7acf6ba6f5162,8cf598980329d183d955ca543c7540eeb665660e..e4bd793334dd463bee8855d0d28bda8d6c15207d
@@@ -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 0af3c56ff5dc7b0bea7ebbfe9a2c028d608187f3,681c4fe8684f1239286c4c753a28314989c68121..85b5a21b369a012d0bc151dd499e268b3a792a9d
@@@ -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;
  
      done=unlink_done;
  
 -#ifdef LOCALE
      setlocale(LC_ALL, "");
 -#endif
      invo_name = r1bindex (argv[0], '/');
  
      /* read user profile/context */
            case DEBUGSW:
                debugsw = 1;
                continue;
+           case DISTSW:
+               dist = 1;
+               continue;
            }
        }
        if (compfile)
        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
       */
  
      /* 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 be5dc79364a024e46317a46bee68ead02100b85d,3ba82fb55b6af676325b18952fe4743888b0b3ed..626eba16293f2a5a6fc1a476f832a6e0eb089bba
@@@ -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 */
                    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 39ccf509382af14bba8d04d7791f227c317d0afe,e0143992219e362aa8bf1d642c70ce946ed5fbfc..1344738248f99aa8de6893fbacb2dcc8cce2b209
@@@ -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;
      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++;