nmh-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-commits] nmh ./ChangeLog h/mh.h h/prototypes.h uip/mhbui...


From: David Levine
Subject: [Nmh-commits] nmh ./ChangeLog h/mh.h h/prototypes.h uip/mhbui...
Date: Tue, 21 Feb 2006 03:58:31 +0000

CVSROOT:        /sources/nmh
Module name:    nmh
Branch:         
Changes by:     David Levine <address@hidden>   06/02/21 03:58:31

Modified files:
        .              : ChangeLog 
        h              : mh.h prototypes.h 
        uip            : mhbuildsbr.c send.c sendsbr.c viamail.c 
                         whatnowsbr.c 
        man            : send.man 

Log message:
        * h/mh.h, h/prototypes.h, uip/mhbuildsbr.c, uip/send.c,
        uip/sendsbr.c, uip/viamail.c, uip/whatnowsbr.c, man/send.man:
        added -attachformat switch to send, to support alternate MIME
        header contents when using -attach.  See send man page for
        description.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/ChangeLog.diff?tr1=1.237&tr2=1.238&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/h/mh.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/h/prototypes.h.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/mhbuildsbr.c.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/send.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/sendsbr.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/viamail.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/whatnowsbr.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/man/send.man.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: nmh/ChangeLog
diff -u nmh/ChangeLog:1.237 nmh/ChangeLog:1.238
--- nmh/ChangeLog:1.237 Tue Feb 21 03:51:53 2006
+++ nmh/ChangeLog       Tue Feb 21 03:58:31 2006
@@ -1,5 +1,11 @@
 2006-02-20  David Levine <address@hidden>
 
+       * h/mh.h, h/prototypes.h, uip/mhbuildsbr.c, uip/send.c,
+       uip/sendsbr.c, uip/viamail.c, uip/whatnowsbr.c, man/send.man:
+       added -attachformat switch to send, to support alternate MIME
+       header contents when using -attach.  See send man page for
+       description.
+
        * man/mhbuild.man: wrapped one appearance of "Content-Disposition"
        with quotes, to be consistent with others.
 
Index: nmh/h/mh.h
diff -u nmh/h/mh.h:1.5 nmh/h/mh.h:1.6
--- nmh/h/mh.h:1.5      Wed Oct  5 10:05:24 2005
+++ nmh/h/mh.h  Tue Feb 21 03:58:31 2006
@@ -2,7 +2,7 @@
 /*
  * mh.h -- main header file for all of nmh
  *
- * $Id: mh.h,v 1.5 2005/10/05 10:05:24 opk Exp $
+ * $Id: mh.h,v 1.6 2006/02/21 03:58:31 levine Exp $
  */
 
 #include <h/nmh.h>
@@ -58,6 +58,8 @@
 
 extern struct swit anoyes[];   /* standard yes/no switches */
 
+#define ATTACHFORMATS 3                /* Number of send attach formats. */
+
 /*
  * general folder attributes
  */
Index: nmh/h/prototypes.h
diff -u nmh/h/prototypes.h:1.14 nmh/h/prototypes.h:1.15
--- nmh/h/prototypes.h:1.14     Sat Jan  7 15:22:20 2006
+++ nmh/h/prototypes.h  Tue Feb 21 03:58:31 2006
@@ -2,7 +2,7 @@
 /*
  * prototypes.h -- various prototypes
  *
- * $Id: prototypes.h,v 1.14 2006/01/07 15:22:20 bress Exp $
+ * $Id: prototypes.h,v 1.15 2006/02/21 03:58:31 levine Exp $
  */
 
 /*
@@ -158,7 +158,7 @@
 int distout (char *, char *, char *);
 void replout (FILE *, char *, char *, struct msgs *, int,
        int, char *, char *, char *);
-int sendsbr (char **, int, char *, struct stat *, int, char *);
+int sendsbr (char **, int, char *, struct stat *, int, char *, int);
 int what_now (char *, int, int, char *, char *,
        int, struct msgs *, char *, int, char *);
 
Index: nmh/man/send.man
diff -u nmh/man/send.man:1.9 nmh/man/send.man:1.10
--- nmh/man/send.man:1.9        Sat Sep  6 17:27:55 2003
+++ nmh/man/send.man    Tue Feb 21 03:58:31 2006
@@ -1,6 +1,6 @@
 .\"
 .\" %nmhwarning%
-.\" $Id: send.man,v 1.9 2003/09/06 17:27:55 gbburkhardt Exp $
+.\" $Id: send.man,v 1.10 2006/02/21 03:58:31 levine Exp $
 .\"
 .TH SEND %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
 .SH NAME
@@ -42,6 +42,8 @@
 .RB [ \-help ]
 .RB [ \-attach
 .IR header-field-name ]
+.RB [ \-attachformat
+.IR 0 " | " 1 " | " 2 ]
 .ad
 .SH DESCRIPTION
 .B Send
@@ -101,6 +103,44 @@
 .I file
 command on the file.
 .PP
+The
+.B -attachformat
+option specifies the MIME header field formats:  a value of
+.B 0,
+the default,
+includes the
+.I x-unix-mode
+attribute as noted above.  A value of
+.B 1
+suppresses both that and the \*(lqContent-Description\*(rq header, and
+adds a \*(lqContent-Disposition\*(rq header.  A value of
+.B 2
+adds the file
+.I modification-date
+parameter to the \*(lqContent-Disposition\*(rq header.  You can
+specify one value in your profile, and override it for individual
+messages at the
+.I whatnow
+prompt.
+.PP
+Here are example message part headers for each of the
+.B -attachformat
+values:
+.PP
+.nf
+-attachformat 0:
+Content-Type: text/plain; name="VERSION"; x-unix-mode="0644";
+Content-Description: ASCII text 
+
+-attachformat 1:
+Content-Type: text/plain; charset="us-ascii"
+Content-Disposition: attachment; filename="VERSION"
+
+-attachformat 2:
+Content-Type: text/plain; charset="us-ascii"
+Content-Disposition: attachment; filename="VERSION"; modification-date="Mon, 
19 Dec 2005 22:39:51 -0600"
+.fi
+.PP
 If
 .B \-push
 is specified,
@@ -350,6 +390,7 @@
 .RB ` \-noverbose '
 .RB ` \-nowatch '
 .RB ` "\-width\ 72" '
+.RB ` "\-attachformat\ 0" '
 .fi
 
 .SH CONTEXT
Index: nmh/uip/mhbuildsbr.c
diff -u nmh/uip/mhbuildsbr.c:1.12 nmh/uip/mhbuildsbr.c:1.13
--- nmh/uip/mhbuildsbr.c:1.12   Sat Feb 18 16:26:37 2006
+++ nmh/uip/mhbuildsbr.c        Tue Feb 21 03:58:31 2006
@@ -2,7 +2,7 @@
 /*
  * mhbuildsbr.c -- routines to expand/translate MIME composition files
  *
- * $Id: mhbuildsbr.c,v 1.12 2006/02/18 16:26:37 levine Exp $
+ * $Id: mhbuildsbr.c,v 1.13 2006/02/21 03:58:31 levine Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -1108,17 +1108,18 @@
                The r1bindex call skips any leading directory
                components. */
             if (ct->c_dispo)
-              ct->c_dispo =
-                incl_name_value (ct->c_dispo,
-                                 "filename",
-                                 r1bindex (extract_name_value ("name",
-                                                               ci->ci_magic),
-                                           '/'));
+                ct->c_dispo =
+                    incl_name_value (ct->c_dispo,
+                                     "filename",
+                                     r1bindex (extract_name_value ("name",
+                                                                   ci->
+                                                                   ci_magic),
+                                               '/'));
         }
        else
            advise (NULL,
                    "extraneous information in message %s's %s: 
field\n%*.*s(%s)",
-               ct->c_file, TYPE_FIELD, i, i, "", cp);
+                    ct->c_file, TYPE_FIELD, i, i, "", cp);
     }
 
     return OK;
@@ -4317,64 +4318,85 @@
 
 
 /* Make sure that buf contains at least one appearance of name,
-   followed by =.  If not, append both name and value.  Note that name
-   should not contain a trailing =.  And quotes will be added around
-   the value.  Typical usage:  make sure that a Content-Disposition
-   header contains filename="foo".  If it doesn't and value does, use
-   value from that. */
+   followed by =.  If not, insert both name and value, just after
+   first semicolon, if any.  Note that name should not contain a
+   trailing =. And quotes will be added around the value.  Typical
+   usage:  make sure that a Content-Disposition header contains
+   filename="foo".  If it doesn't and value does, use value from
+   that. */
 static char *
 incl_name_value (char *buf, char *name, char *value) {
-  char *newbuf = buf;
+    char *newbuf = buf;
 
-  /* Assume that name is non-null. */
-  if (buf && value) {
-    char *name_plus_equal = concat (name, "=", NULL);
+    /* Assume that name is non-null. */
+    if (buf && value) {
+       char *name_plus_equal = concat (name, "=", NULL);
+
+       if (! strstr (buf, name_plus_equal)) {
+           char *insertion;
+           char *cp;
+           char *prefix, *suffix;
+
+           /* Trim trailing space, esp. newline. */
+           for (cp = &buf[strlen (buf) - 1];
+                cp >= buf && isspace (*cp);
+                --cp) {
+               *cp = '\0';
+           }
 
-    if (! strstr (buf, name_plus_equal)) {
-      char *appendage;
-      char *cp;
+           insertion = concat ("; ", name, "=", "\"", value, "\"", NULL);
 
-      /* Trim trailing space, esp. newline. */
-      for (cp = &buf[strlen (buf) - 1]; cp >= buf && isspace (*cp); --cp) {
-        *cp = '\0';
-      }
+           /* Insert at first semicolon, if any.  If none, append to
+              end. */
+           prefix = add (buf, NULL);
+           if ((cp = strchr (prefix, ';'))) {
+               suffix = concat (cp, NULL);
+               *cp = '\0';
+               newbuf = concat (prefix, insertion, suffix, "\n", NULL);
+               free (suffix);
+           } else {
+               /* Append to end. */
+               newbuf = concat (buf, insertion, "\n", NULL);
+           }
 
-      appendage = concat ("; ", name, "=", "\"", value, "\"\n", NULL);
-      newbuf = add (appendage, buf);
-      free (appendage);
-    }
+           free (prefix);
+           free (insertion);
+           free (buf);
+       }
 
-    free (name_plus_equal);
-  }
+       free (name_plus_equal);
+    }
 
-  return newbuf;
+    return newbuf;
 }
 
 
-/* Extract just name_suffix="foo", if any, from value.  If there isn't
+/* Extract just name_suffix="foo", if any, from value. If there isn't
    one, return the entire value.  Note that, for example, a name_suffix
    of name will match filename="foo", and return foo. */
 static char *
 extract_name_value (char *name_suffix, char *value) {
-  char *extracted_name_value = value;
-  char *name_suffix_plus_quote = concat (name_suffix, "=\"", NULL);
-  char *name_suffix_equals = strstr (value, name_suffix_plus_quote);
-  char *cp;
-
-  free (name_suffix_plus_quote);
-  if (name_suffix_equals) {
-    char *name_suffix_begin;
-
-    /* Find first \". */
-    for (cp = name_suffix_equals; *cp != '"'; ++cp) /* empty */;
-    name_suffix_begin = ++cp;
-    /* Find second \". */
-    for (; *cp != '"'; ++cp) /* empty */;
-
-    extracted_name_value = mh_xmalloc (cp - name_suffix_begin + 1);
-    memcpy (extracted_name_value, name_suffix_begin, cp - name_suffix_begin);
-    extracted_name_value[cp - name_suffix_begin] = '\0';
-  }
+    char *extracted_name_value = value;
+    char *name_suffix_plus_quote = concat (name_suffix, "=\"", NULL);
+    char *name_suffix_equals = strstr (value, name_suffix_plus_quote);
+    char *cp;
+
+    free (name_suffix_plus_quote);
+    if (name_suffix_equals) {
+       char *name_suffix_begin;
+
+       /* Find first \". */
+       for (cp = name_suffix_equals; *cp != '"'; ++cp) /* empty */;
+       name_suffix_begin = ++cp;
+       /* Find second \". */
+       for (; *cp != '"'; ++cp) /* empty */;
+
+       extracted_name_value = mh_xmalloc (cp - name_suffix_begin + 1);
+       memcpy (extracted_name_value,
+               name_suffix_begin,
+               cp - name_suffix_begin);
+       extracted_name_value[cp - name_suffix_begin] = '\0';
+    }
 
-  return extracted_name_value;
+    return extracted_name_value;
 }
Index: nmh/uip/send.c
diff -u nmh/uip/send.c:1.7 nmh/uip/send.c:1.8
--- nmh/uip/send.c:1.7  Tue Sep 30 16:58:43 2003
+++ nmh/uip/send.c      Tue Feb 21 03:58:31 2006
@@ -2,7 +2,7 @@
 /*
  * send.c -- send a composed message
  *
- * $Id: send.c,v 1.7 2003/09/30 16:58:43 gbburkhardt Exp $
+ * $Id: send.c,v 1.8 2006/02/21 03:58:31 levine Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -104,6 +104,8 @@
     { "user", SASLminc(-4) },
 #define ATTACHSW              40
     { "attach", 6 },
+#define ATTACHFORMATSW        41
+    { "attachformat", 7 },
     { NULL, 0 }
 };
 
@@ -142,6 +144,7 @@
     struct msgs *mp;
     struct stat st;
     char       *attach = (char *)0;    /* header field name for attachments */
+    int attachformat = 0; /* mhbuild format specifier for attachments */
 #ifdef UCI
     FILE *fp;
 #endif /* UCI */
@@ -280,6 +283,21 @@
                    if (!(attach = *argp++) || *attach == '-')
                        adios (NULL, "missing argument to %s", argp[-2]);
                    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;
+                   continue;
            }
        } else {
            msgs[msgp++] = cp;
@@ -443,7 +461,8 @@
     closefds (3);
 
     for (msgnum = 0; msgnum < msgp; msgnum++) {
-       switch (sendsbr (vec, vecp, msgs[msgnum], &st, 1, attach)) {
+       switch (sendsbr (vec, vecp, msgs[msgnum], &st, 1, attach,
+                        attachformat)) {
            case DONE: 
                done (++status);
            case NOTOK: 
Index: nmh/uip/sendsbr.c
diff -u nmh/uip/sendsbr.c:1.9 nmh/uip/sendsbr.c:1.10
--- nmh/uip/sendsbr.c:1.9       Mon Jan  2 03:25:18 2006
+++ nmh/uip/sendsbr.c   Tue Feb 21 03:58:31 2006
@@ -2,7 +2,7 @@
 /*
  * sendsbr.c -- routines to help WhatNow/Send along
  *
- * $Id: sendsbr.c,v 1.9 2006/01/02 03:25:18 bress Exp $
+ * $Id: sendsbr.c,v 1.10 2006/02/21 03:58:31 levine Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -54,7 +54,7 @@
 /*
  * external prototypes
  */
-int sendsbr (char **, int, char *, struct stat *, int, char *);
+int sendsbr (char **, int, char *, struct stat *, int, char *, int);
 int done (int);
 char *getusername (void);
 
@@ -68,10 +68,10 @@
 static int splitmsg (char **, int, char *, struct stat *, int);
 static int sendaux (char **, int, char *, struct stat *);
 
-static int     attach(char *, char *);
+static int     attach(char *, char *, int);
 static void    clean_up_temporary_files(void);
 static int     get_line(void);
-static void    make_mime_composition_file_entry(char *);
+static void    make_mime_composition_file_entry(char *, int);
 
 
 /*
@@ -79,7 +79,7 @@
  */
 
 int
-sendsbr (char **vec, int vecp, char *drft, struct stat *st, int rename_drft, 
char *attachment_header_field_name)
+sendsbr (char **vec, int vecp, char *drft, struct stat *st, int rename_drft, 
char *attachment_header_field_name, int attachformat)
 {
     int status;
     char buffer[BUFSIZ], file[BUFSIZ];
@@ -104,7 +104,7 @@
      */
 
     if (attachment_header_field_name != (char *)0) {
-       switch (attach(attachment_header_field_name, drft)) {
+       switch (attach(attachment_header_field_name, drft, attachformat)) {
        case OK:
            drft = composition_file_name;
            break;
@@ -188,7 +188,8 @@
 }
 
 static int
-attach(char *attachment_header_field_name, char *draft_file_name)
+attach(char *attachment_header_field_name, char *draft_file_name,
+       int attachformat)
 {
     char               buf[MAXPATHLEN + 6];    /* miscellaneous buffer */
     int                        c;                      /* current character 
for body copy */
@@ -294,7 +295,7 @@
      */
 
     if (has_body)
-       make_mime_composition_file_entry(body_file_name);
+       make_mime_composition_file_entry(body_file_name, attachformat);
 
     /*
      * Now, go back to the beginning of the draft file and look for header 
fields
@@ -308,7 +309,7 @@
            for (p = field + length + 1; *p == ' ' || *p == '\t'; p++)
                ;
 
-           make_mime_composition_file_entry(p);
+           make_mime_composition_file_entry(p, attachformat);
        }
     }
 
@@ -376,7 +377,7 @@
 }
 
 static void
-make_mime_composition_file_entry(char *file_name)
+make_mime_composition_file_entry(char *file_name, int attachformat)
 {
     int                        binary;                 /* binary character 
found flag */
     int                        c;                      /* current character */
@@ -444,41 +445,64 @@
        adios((char *)0, "unable to access file \"%s\"", file_name);
     }
 
-    (void)fprintf(composition_file, "#%s; name=\"%s\"; x-unix-mode=0%.3ho",
-     content_type, ((p = strrchr(file_name, '/')) == (char *)0) ? file_name : 
p + 1, (unsigned short)(st.st_mode & 0777));
-
-    if (strlen(file_name) > MAXPATHLEN) {
-       clean_up_temporary_files();
-       adios((char *)0, "attachment file name `%s' too long.", file_name);
-    }
-
-    (void)sprintf(cmd, "file '%s'", file_name);
-
-    if ((fp = popen(cmd, "r")) != (FILE *)0 && fgets(cmd, sizeof (cmd), fp) != 
(char *)0) {
-       *strchr(cmd, '\n') = '\0';
-
-       /*
-        *  The output of the "file" command is of the form
-        *
-        *      file:   description
-        *
-        *  Strip off the "file:" and subsequent white space.
-        */
-
-       for (p = cmd; *p != '\0'; p++) {
-           if (*p == ':') {
-               for (p++; *p != '\0'; p++) {
-                   if (*p != '\t')
-                       break;
-               }
-               break;
-           }
-       }
-
-       if (*p != '\0')
-           (void)fprintf(composition_file, " [ %s ]", p);
+    switch (attachformat) {
+    case 0:
+        /* Insert name, file mode, and Content-Id. */
+        (void)fprintf(composition_file, "#%s; name=\"%s\"; x-unix-mode=0%.3ho",
+            content_type, ((p = strrchr(file_name, '/')) == (char *)0) ? 
file_name : p + 1, (unsigned short)(st.st_mode & 0777));
+
+        if (strlen(file_name) > MAXPATHLEN) {
+            clean_up_temporary_files();
+            adios((char *)0, "attachment file name `%s' too long.", file_name);
+        }
+
+        (void)sprintf(cmd, "file '%s'", file_name);
+
+        if ((fp = popen(cmd, "r")) != (FILE *)0 && fgets(cmd, sizeof (cmd), 
fp) != (char *)0) {
+            *strchr(cmd, '\n') = '\0';
+
+            /*
+             *  The output of the "file" command is of the form
+             *
+             *         file:   description
+             *
+             *  Strip off the "file:" and subsequent white space.
+             */
+
+            for (p = cmd; *p != '\0'; p++) {
+                if (*p == ':') {
+                    for (p++; *p != '\0'; p++) {
+                        if (*p != '\t')
+                            break;
+                    }
+                    break;
+                }
+            }
+
+            if (*p != '\0')
+                /* Insert Content-Description. */
+                (void)fprintf(composition_file, " [ %s ]", p);
+
+            (void)pclose(fp);
+        }
+
+        break;
+    case 1:
+        /* Suppress Content-Id, insert simple Content-Disposition. */
+        (void) fprintf (composition_file, "#%s <>{attachment}", content_type);
+
+        break;
+    case 2:
+        /* Suppress Content-Id, insert Content-Disposition with
+           modification date. */
+        (void) fprintf (composition_file,
+                        "#%s <>{attachment; modification-date=\"%s\"}",
+                        content_type,
+                        dtime (&st.st_mtim, 0));
 
-       (void)pclose(fp);
+        break;
+    default:
+        adios ((char *)0, "unsupported attachformat %d", attachformat);
     }
 
     /*
Index: nmh/uip/viamail.c
diff -u nmh/uip/viamail.c:1.9 nmh/uip/viamail.c:1.10
--- nmh/uip/viamail.c:1.9       Tue Sep 30 16:58:43 2003
+++ nmh/uip/viamail.c   Tue Feb 21 03:58:31 2006
@@ -2,7 +2,7 @@
 /*
  * viamail.c -- send multiple files in a MIME message
  *
- * $Id: viamail.c,v 1.9 2003/09/30 16:58:43 gbburkhardt Exp $
+ * $Id: viamail.c,v 1.10 2006/02/21 03:58:31 levine Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -236,7 +236,7 @@
     if (verbsw)
        vec[vecp++] = "-verbose";
 
-    switch (sendsbr (vec, vecp, tmpfil, &st, 0, (char *)0)) {
+    switch (sendsbr (vec, vecp, tmpfil, &st, 0, (char *)0, 0)) {
        case DONE:
        case NOTOK:
            status++;
Index: nmh/uip/whatnowsbr.c
diff -u nmh/uip/whatnowsbr.c:1.8 nmh/uip/whatnowsbr.c:1.9
--- nmh/uip/whatnowsbr.c:1.8    Mon Jan  2 03:17:42 2006
+++ nmh/uip/whatnowsbr.c        Tue Feb 21 03:58:31 2006
@@ -2,7 +2,7 @@
 /*
  * whatnowsbr.c -- the WhatNow shell
  *
- * $Id: whatnowsbr.c,v 1.8 2006/01/02 03:17:42 bress Exp $
+ * $Id: whatnowsbr.c,v 1.9 2006/02/21 03:58:31 levine Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -1005,6 +1005,8 @@
     { "user", SASLminc(-4) },
 #define SNDATTACHSW       39
     { "attach file", 6 },
+#define SNDATTACHFORMAT   40
+    { "attachformat", 7 },
     { NULL, 0 }
 };
 
@@ -1030,6 +1032,8 @@
     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 @@
                        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 @@
     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);
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]