X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fmhoutsbr.c;h=92352539e5534c045a127d6b047ab8ea63eb7675;hb=e056446589e2fee53f823e0da1fb34076018c3dd;hp=f292ddc80c5ca81c5f65e80afb51df1090a86c42;hpb=8f4c5da8971926f7eccc912f7998c343aef3c33b;p=mmh diff --git a/uip/mhoutsbr.c b/uip/mhoutsbr.c index f292ddc..9235253 100644 --- a/uip/mhoutsbr.c +++ b/uip/mhoutsbr.c @@ -4,6 +4,10 @@ * -- given a Content structure * * $Id$ + * + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include @@ -12,7 +16,7 @@ #include #include #include -#include +#include #include #include #include @@ -22,7 +26,6 @@ #endif -extern int errno; extern int ebcdicsw; static char ebcdicsafe[0x100] = { @@ -67,6 +70,7 @@ static char nib2b64[0x40+1] = * prototypes */ int output_message (CT, char *); +int output_message_fp (CT, FILE *, char *); int writeBase64aux (FILE *, FILE *); /* @@ -87,27 +91,33 @@ static int writeBase64 (CT, FILE *); */ int -output_message (CT ct, char *file) +output_message_fp (CT ct, FILE *fp, char *file) { - FILE *fp; - - if ((fp = fopen (file, "w")) == NULL) { - advise (file, "unable to open for writing"); - return NOTOK; - } - if (output_content (ct, fp) == NOTOK) return NOTOK; if (fflush (fp)) { - advise (file, "error writing to"); + advise ((file?file:""), "error writing to"); return NOTOK; } - fclose (fp); - return OK; } +int +output_message (CT ct, char *file) +{ + FILE *fp; + int status; + + if ((fp = fopen (file, "w")) == NULL) { + advise (file, "unable to open for writing"); + return NOTOK; + } + status = output_message_fp(ct, fp, file); + fclose(fp); + return status; +} + /* * Output a Content structure to a file. @@ -260,7 +270,7 @@ writeExternalBody (CT ct, FILE *out) case 'N': for (ap = ci2->ci_attrs, ep = ci2->ci_values; *ap; ap++, ep++) - if (!strcasecmp (*ap, "name")) { + if (!mh_strcasecmp (*ap, "name")) { fprintf (out, "%s", *ep); break; }