- ct = build_mime (infile, directives, header_encoding);
- cts[0] = ct;
- cts[1] = NULL;
-
- /* output MIME message to this temporary file */
- strncpy (outfile, m_mktemp(invo_name, NULL, &fp_out), sizeof(outfile));
- unlink_outfile = 1;
-
- /* output the message */
- output_message_fp (ct, fp_out, outfile);
- fclose(fp_out);
-
- /* output the temp file to standard output */
- if ((fp = fopen (outfile, "r")) == NULL)
- adios (outfile, "unable to open");
- while (fgets (buffer, BUFSIZ, fp))
- fputs (buffer, stdout);
- fclose (fp);
+ ct = build_mime (infile, autobuild, directives, header_encoding);
+
+ /*
+ * If ct == NULL, that means that -auto was set and a MIME version
+ * header was already seen. Just use the input file as the output
+ */
+
+ if (!ct) {
+ if (! (fp = fopen(infile, "r"))) {
+ adios(NULL, "Unable to open %s for reading", infile);
+ }
+ while (fgets(buffer, BUFSIZ, fp))
+ fputs(buffer, stdout);
+ } else {
+ /* output the message */
+ output_message_fp (ct, stdout, NULL);
+ free_content (ct);
+ }