]> diplodocus.org Git - nmh/commitdiff
More cleaned and conversion to the new parameter API.
authorKen Hornstein <kenh@pobox.com>
Sun, 2 Mar 2014 04:51:19 +0000 (23:51 -0500)
committerKen Hornstein <kenh@pobox.com>
Sun, 2 Mar 2014 04:51:19 +0000 (23:51 -0500)
uip/mhbuildsbr.c
uip/mhlistsbr.c
uip/mhoutsbr.c
uip/mhshowsbr.c

index 0d20a67..a5b7dfe 100644 (file)
@@ -1164,7 +1164,7 @@ compose_content (CT ct)
 
                        for (pm = ci->ci_first_pm; pm; pm = pm->pm_next) {
                            snprintf (bp, buflen, "%s%s=\"%s\"", s,
-                                     pm->pm_name, pm->pm_value);
+                                     pm->pm_name, get_param_value(pm));
                            len = strlen (bp);
                            bp += len;
                            buflen -= len;
index 5105a6a..45aa89f 100644 (file)
@@ -258,7 +258,7 @@ list_debug (CT ct)
     /* print parsed parameters attached to content type */
     fprintf (stderr, "    parameters\n");
     for (pm = ci->ci_first_pm; pm; pm = pm->pm_next)
-       fprintf (stderr, "      %s=\"%s\"\n", pm->pm_name, pm->pm_value);
+       fprintf (stderr, "      %s=\"%s\"\n", pm->pm_name, get_param_value(pm));
 
     /* print internal flags for type/subtype */
     fprintf (stderr, "    type 0x%x subtype 0x%x params 0x%x\n",
index 7c3cbe9..cb530e1 100644 (file)
@@ -81,14 +81,10 @@ output_content (CT ct, FILE *out)
 {
     int result = 0;
     CI ci = &ct->c_ctinfo;
-    PM pm;
-    char *boundary = "";
+    char *boundary = "", *cp;
 
-    for (pm = ci->ci_first_pm; pm; pm = pm->pm_next) {
-        if (! strcasecmp ("boundary", pm->pm_name)) {
-            boundary = pm->pm_value;
-            break;
-        }
+    if ((cp = get_param(ci->ci_first_pm, "boundary, '-', 0)))
+       boundary = cp;
     }
 
     /*
@@ -101,8 +97,11 @@ output_content (CT ct, FILE *out)
      * "message/external", then we are done with the
      * headers (since it has no body).
      */
-    if (ct->c_ctexbody)
+    if (ct->c_ctexbody) {
+       if (boundary && *boundary != '\0')
+           free(boundary);
        return OK;
+    }
 
     /*
      * Now output the content bodies.
@@ -126,8 +125,11 @@ output_content (CT ct, FILE *out)
            CT p = part->mp_part;
 
            fprintf (out, "\n--%s\n", boundary);
-           if (output_content (p, out) == NOTOK)
+           if (output_content (p, out) == NOTOK) {
+               if (boundary && *boundary != '\0')
+                   free(boundary);
                return NOTOK;
+           }
        }
        fprintf (out, "\n--%s--\n", boundary);
 
@@ -199,6 +201,9 @@ output_content (CT ct, FILE *out)
        break;
     }
 
+    if (boundary && *boundary != '\0')
+       free(boundary);
+
     return result;
 }
 
@@ -228,7 +233,6 @@ static int
 writeExternalBody (CT ct, FILE *out)
 {
     char *cp;
-    PM pm;
     struct exbody *e = (struct exbody *) ct->c_ctparams;
                
     putc ('\n', out);
index 61b0057..416fe93 100644 (file)
@@ -341,7 +341,7 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
 
                for (pm = ci->ci_first_pm; pm; pm = pm->pm_next) {
                    snprintf (bp, buflen, "%s%s=\"%s\"", s, pm->pm_name,
-                             pm->pm_value);
+                             get_param_value(pm));
                    len = strlen (bp);
                    bp += len;
                    buflen -= len;
@@ -849,7 +849,7 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp)
 
                for (pm = ci->ci_first_pm; pm; pm = pm->pm_next) {
                    snprintf (bp, buflen, "%s%s=\"%s\"", s, pm->pm_name,
-                             pm->pm_value);
+                             get_param_value(pm));
                    len = strlen (bp);
                    bp += len;
                    buflen -= len;