- fprintf(out, "Date: %s\n", dtimenow(0));
- if (msgflags & MFRM) {
- /* There was already a From: in the draft. Don't add one. */
- 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);
- } else
- /* Construct a From: header. */
- fprintf(out, "From: %s\n", signature);
- if (subject)
- fprintf(out, "Subject: %s", subject);
- fprintf(out, "BCC:\n\n------- Blind-Carbon-Copy\n\n");
- fflush(out);
-
- if (filter == NULL) {
- 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);
-
- for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
- sleep(5);
- switch (child_id) {
- case NOTOK:
- adios("fork", "unable to");
-
- case OK:
- dup2(fileno(out), 1);
-
- i = 1;
- vec[i++] = "-forward";
- vec[i++] = "-form";
- vec[i++] = filter;
- vec[i++] = tmpfil;
- vec[i] = NULL;
-
- execvp(mhlproc, vec);
- adios(mhlproc, "unable to exec");
-
- default:
- if (status = pidwait(child_id, OK))
- admonish(NULL, "%s lost (status=0%o)",
- vec[0], status);
- break;
- }
+ if (verbose) {
+ printf("%sFcc: %s\n", msgstate == resent ? "Resent-" : "",
+ folders);
+ fflush(stdout);
+ }
+ if (strlen(fileproc)+strlen(file)+strlen(folders)+100 > sizeof cmd) {
+ adios(NULL, "Too much Fcc data");
+ }
+ /* hack: read from /dev/null and refile(1) won't question us */
+ snprintf(cmd, sizeof cmd, "</dev/null %s -link -file %s %s",
+ fileproc, file, folders);
+ status = system(cmd);
+ if (status == -1) {
+ fprintf(stderr, "Skipped %sFcc %s: unable to system().\n",
+ msgstate == resent ? "Resent-" : "", folders);
+ } else if (status != 0) {
+ fprintf(stderr, "%sFcc %s: Problems occured.\n",
+ msgstate == resent ? "Resent-" : "", folders);