From: Ken Hornstein Date: Sun, 2 Mar 2014 04:51:19 +0000 (-0500) Subject: More cleaned and conversion to the new parameter API. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/a5aa6164d9e9c178c800187fa606f83c1bac916f?ds=sidebyside More cleaned and conversion to the new parameter API. --- diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 0d20a671..a5b7dfef 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -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; diff --git a/uip/mhlistsbr.c b/uip/mhlistsbr.c index 5105a6a9..45aa89f0 100644 --- a/uip/mhlistsbr.c +++ b/uip/mhlistsbr.c @@ -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", diff --git a/uip/mhoutsbr.c b/uip/mhoutsbr.c index 7c3cbe99..cb530e1e 100644 --- a/uip/mhoutsbr.c +++ b/uip/mhoutsbr.c @@ -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); diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 61b00573..416fe938 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -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;