X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fmhoutsbr.c;h=7e12c46a72fa17a4ad6f9c30f299bea83f49ac57;hb=5d43a99db70c12a673028c7758c20cbe3e13ef5f;hp=2ebdc1ff296a65f5957f7b143064411a86d4bf44;hpb=d2f12554a254e814dcdafb3828fc0d9936154eef;p=mmh diff --git a/uip/mhoutsbr.c b/uip/mhoutsbr.c index 2ebdc1f..7e12c46 100644 --- a/uip/mhoutsbr.c +++ b/uip/mhoutsbr.c @@ -3,8 +3,6 @@ * mhoutsbr.c -- routines to output MIME messages * -- 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. @@ -70,6 +68,7 @@ static char nib2b64[0x40+1] = * prototypes */ int output_message (CT, char *); +int output_message_fp (CT, FILE *, char *); int writeBase64aux (FILE *, FILE *); /* @@ -90,27 +89,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.