]> diplodocus.org Git - nmh/blobdiff - uip/mhbuildsbr.c
Pass through message even if from relative folder.
[nmh] / uip / mhbuildsbr.c
index c72bd8185a8a6ee01a0c3dc18965ba58d23d481c..df346feccc33e6a98de5f5a5ed7612fdd2f9993a 100644 (file)
@@ -190,9 +190,8 @@ build_mime (char *infile, int autobuild, int dist, int directives,
                    fclose(in);
                    free (ct);
                    return NULL;
-               } else {
-                   adios (NULL, "draft shouldn't contain %s: field", name);
                }
+                adios (NULL, "draft shouldn't contain %s: field", name);
            }
 
            /* ignore any Content-Type fields in the header */
@@ -613,23 +612,26 @@ static char *
 fgetstr (char *s, int n, FILE *stream)
 {
     char *cp, *ep;
-    int o_n = n;
 
+    ep = s + n;
     while(1) {
-       for (ep = (cp = s) + o_n; cp < ep; ) {
-           int i;
+       for (cp = s; cp < ep;) {
+           int len;
 
            if (!fgets (cp, n, stream))
-               return (cp != s ? s : NULL);
+                return cp == s ? NULL : s; /* "\\\nEOF" ignored. */
 
            if (cp == s && *cp != '#')
-               return s;
+               return s; /* Plaintext line. */
 
-           cp += (i = strlen (cp)) - 1;
-           if (i <= 1 || *cp-- != '\n' || *cp != '\\')
+           len = strlen(cp);
+           if (len <= 1)
+               break; /* Can't contain "\\\n". */
+           cp += len - 1; /* Just before NUL. */
+           if (*cp-- != '\n' || *cp != '\\')
                break;
-           *cp = '\0';
-           n -= (i - 2);
+           *cp = '\0'; /* Erase the trailing "\\\n". */
+           n -= (len - 2);
        }
 
        if (strcmp(s, "#on\n") == 0) {
@@ -639,11 +641,9 @@ fgetstr (char *s, int n, FILE *stream)
        } else if (strcmp(s, "#pop\n") == 0) {
            directive_pop();
        } else {
-           break;
+           return s;
        }
     }
-
-    return s;
 }
 
 
@@ -711,9 +711,8 @@ user_content (FILE *in, char *buf, CT *ctp, const char *infilename)
            strncpy (content, buf + 2, sizeof(content));
            inlineD = 1;
            goto rock_and_roll;
-       } else {
-           inlineD = 0;
        }
+        inlineD = 0;
 
        /* the directive is implicit */
        strncpy (content, "text/plain", sizeof(content));
@@ -1761,8 +1760,7 @@ build_headers (CT ct, int header_encoding)
        np = output_params(len, ct->c_dispo_first, NULL, 0);
        vp = add(np, vp);
        vp = add("\n", vp);
-       if (np)
-           free(np);
+        mh_xfree(np);
        add_header (ct, mh_xstrdup(DISPO_FIELD), vp);
     }
 
@@ -2035,8 +2033,7 @@ setup_attach_content(CT ct, char *filename)
 
     for (pm = ct->c_ctinfo.ci_first_pm; pm; pm = pm->pm_next) {
        if (strcasecmp(pm->pm_name, "name") == 0) {
-           if (pm->pm_value)
-               free(pm->pm_value);
+            mh_xfree(pm->pm_value);
            pm->pm_value = mh_xstrdup(simplename);
            break;
        }
@@ -2274,9 +2271,8 @@ expand_pseudoheader (CT ct, CT *text_plain_ct, struct multipart *m,
             free (reply_file);
             admonish (NULL, "failed to read %s", reply_file);
             return;
-        } else {
-            (void) close (fd);
-        }
+        } 
+        (void) close (fd);
     }
 
     /* This sets reply_ct->c_ctparams, and reply_ct->c_termproc if the