X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/53bb0e7c20cda145c56c3aa4557c467e1832578b..b11a86cf7a0fc5b0dfef070e0bc65754c7d26016:/uip/mhbuildsbr.c diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index d96e0d54..df9bf5b7 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -129,7 +129,7 @@ static void directive_pop(void) */ CT -build_mime (char *infile, int directives, int header_encoding) +build_mime (char *infile, int autobuild, int directives, int header_encoding) { int compnum, state; char buf[BUFSIZ], name[NAMESZ]; @@ -176,13 +176,16 @@ build_mime (char *infile, int directives, int header_encoding) case FLDPLUS: compnum++; - /* abort if draft has Mime-Version header field */ - if (!strcasecmp (name, VRSN_FIELD)) - adios (NULL, "draft shouldn't contain %s: field", VRSN_FIELD); - - /* abort if draft has Content-Transfer-Encoding header field */ - if (!strcasecmp (name, ENCODING_FIELD)) - adios (NULL, "draft shouldn't contain %s: field", ENCODING_FIELD); + /* abort if draft has Mime-Version or C-T-E header field */ + if (strcasecmp (name, VRSN_FIELD) == 0 || + strcasecmp (name, ENCODING_FIELD) == 0) { + if (autobuild) { + fclose(in); + return NULL; + } else { + adios (NULL, "draft shouldn't contain %s: field", name); + } + } /* ignore any Content-Type fields in the header */ if (!strcasecmp (name, TYPE_FIELD)) { @@ -248,12 +251,10 @@ finish_field: /* if this wasn't the last header field, then continue */ continue; - case FILEEOF: - adios (NULL, "draft has empty body -- no directives!"); - /* NOTREACHED */ - case BODY: fseek (in, (long) (-strlen (buf)), SEEK_CUR); + /* fall through */ + case FILEEOF: break; case LENERR: