Comment changes.
[mmh] / uip / sendsbr.c
index 150c175..8eb67cc 100644 (file)
@@ -30,7 +30,6 @@ int debugsw = 0;  /* global */
 int forwsw  = 1;
 int inplace = 1;
 int pushsw  = 0;
-int unique  = 0;
 int verbsw  = 0;
 
 char *altmsg   = NULL;  /*  .. */
@@ -79,7 +78,7 @@ int
 sendsbr(char **vec, int vecp, char *drft, struct stat *st, int rename_drft)
 {
        int status;
-       char buffer[BUFSIZ], file[BUFSIZ];
+       char buffer[BUFSIZ];
        char *original_draft;  /* name of original draft file */
        char *p;  /* string pointer for building file name */
 
@@ -115,23 +114,7 @@ sendsbr(char **vec, int vecp, char *drft, struct stat *st, int rename_drft)
        done=armed_done;
        switch (setjmp(env)) {
        case OK:
-               /*
-               ** If given -push and -unique (which is undocumented), then
-               ** rename the draft file.  I'm not quite sure why.
-               */
-               if (pushsw && unique) {
-                       char *cp = m_mktemp2(drft, invo_name, NULL, NULL);
-                       if (cp == NULL) {
-                               adios("sendsbr", "unable to create temporary file");
-                       }
-                       if (rename(drft, strncpy(file, cp, sizeof(file)))
-                                       == NOTOK)
-                               adios(file, "unable to rename %s to", drft);
-                       drft = file;
-               }
-
                status = sendaux(vec, vecp, drft, st) ? NOTOK : OK;
-
                /* rename the original draft */
                if (rename_drft && status == OK &&
                                rename(original_draft, strncpy(buffer,
@@ -192,10 +175,7 @@ attach(char *draft_file_name)
        int length;  /* length of attachment header field name */
        char *p;  /* miscellaneous string pointer */
 
-       /*
-       ** Open up the draft file.
-       */
-
+       /* Open up the draft file. */
        if ((draft_file = fopen(draft_file_name, "r")) == (FILE *)0)
                adios(NULL, "can't open draft file `%s'.",
                                draft_file_name);
@@ -204,7 +184,6 @@ attach(char *draft_file_name)
        **  Allocate a buffer to hold the header components as they're read in.
        **  This buffer might need to be quite large, so we grow it as needed.
        */
-
        field = (char *)mh_xmalloc(field_size = 256);
 
        /*
@@ -214,7 +193,6 @@ attach(char *draft_file_name)
        ** because we're done.  Read to the end of the headers even if
        ** we have no attachments.
        */
-
        length = strlen(attach_hdr);
 
        has_attachment = 0;
@@ -231,7 +209,6 @@ attach(char *draft_file_name)
        ** Check if body contains at least one non-blank (= not empty)
        ** and if it contains any non-ASCII chars (= need MIME).
        */
-
        has_body = 0;
        non_ascii = 0;
 
@@ -319,10 +296,15 @@ attach(char *draft_file_name)
        while (get_line() != EOF && *field != '\0' && *field != '-') {
                if (strncasecmp(field, attach_hdr, length) == 0 &&
                                field[length] == ':') {
-                       for (p = field + length + 1; *p == ' ' || *p == '\t';
-                                       p++)
-                               ;
-                       make_mime_composition_file_entry(p);
+                       for (p = field+length+1; *p==' ' || *p=='\t'; p++) {
+                               continue;
+                       }
+                       if (*p == '+') {
+                               /* forwarded message */
+                               fprintf(composition_file, "#forw [forwarded message(s)] %s\n", p);
+                       } else {
+                               make_mime_composition_file_entry(p);
+                       }
                }
        }
 
@@ -496,20 +478,14 @@ sendaux(char **vec, int vecp, char *drft, struct stat *st)
 {
        pid_t child_id;
        int i, status, fd, fd2;
-       char backup[BUFSIZ], buf[BUFSIZ];
+       char backup[BUFSIZ];
 
        fd = pushsw ? tmp_fd() : NOTOK;
        fd2 = NOTOK;
 
        vec[vecp++] = drft;
-       if (annotext) {
-               if ((fd2 = tmp_fd()) != NOTOK) {
-                       vec[vecp++] = "-idanno";
-                       snprintf(buf, sizeof(buf), "%d", fd2);
-                       vec[vecp++] = buf;
-               } else {
-                       admonish(NULL, "unable to create file for annotation list");
-               }
+       if (annotext && (fd2 = tmp_fd()) == NOTOK) {
+               admonish(NULL, "unable to create file for annotation list");
        }
        if (distfile && distout(drft, distfile, backup) == NOTOK)
                done(1);
@@ -786,7 +762,7 @@ annoaux(int fd)
                if (is_selected(mp, msgnum)) {
                        if (debugsw)
                                advise(NULL, "annotate message %d", msgnum);
-                       annotate(m_name (msgnum), annotext, cp, inplace,
+                       annotate(m_name(msgnum), annotext, cp, inplace,
                                        1, -2, 0);
                }
        }