- pid_t child_id;
- int fd, i, status;
- char *vec[6];
- FILE * in, *out;
-
-#ifdef HAVE_MKSTEMP
- fd = mkstemp(bccfil);
- if (fd == -1 || (out = fdopen(fd, "w")) == NULL)
- adios(bccfil, "unable to create");
-#else
- mktemp(bccfil);
- if ((out = fopen(bccfil, "w")) == NULL)
- adios(bccfil, "unable to create");
-#endif
- chmod(bccfil, 0600);
-
- fprintf(out, "Date: %s\n", dtimenow(0));
- if (!(msgflags & MFRM)) {
- /* Construct a From: header. */
- fprintf(out, "From: %s\n", signature);
- } else if (!draft_from_masquerading) {
- /*
- ** mts.conf didn't contain "masquerade:[...]draft_from[...]"
- ** so we'll reveal the user's actual account@thismachine
- ** address in a Sender: header (and use it as the envelope
- ** From: later).
- */
- fprintf(out, "Sender: %s\n", from);
- }
- if (subject)
- fprintf(out, "Subject: %s", subject);
- fprintf(out, "BCC:\n\n------- Blind-Carbon-Copy\n\n");
- fflush(out);
-
- if (!filter) {
- if ((fd = open(tmpfil, O_RDONLY)) == NOTOK)
- adios(NULL, "unable to re-open");
- cpydgst(fd, fileno(out), tmpfil, bccfil);
- close(fd);
- } else {
- vec[0] = mhbasename(mhlproc);