- if (iscc)
- cclist = cclist ? add (cp, add (", ", cclist)) : getcpy (cp);
- else
- tolist = tolist ? add (cp, add (", ", tolist)) : getcpy (cp);
- }
-
- if (tolist == NULL)
- adios (NULL, "usage: %s addrs ... [switches]", invo_name);
-
- tfile = m_mktemp2(NULL, invo_name, NULL, &out);
- if (tfile == NULL) adios("mhmail", "unable to create temporary file");
- chmod(tfile, 0600);
- strncpy (tmpfil, tfile, sizeof(tmpfil));
-
- SIGNAL2 (SIGINT, intrser);
-
- fprintf (out, "%sTo: %s\n", resent ? "Resent-" : "", tolist);
- if (cclist)
- fprintf (out, "%scc: %s\n", resent ? "Resent-" : "", cclist);
- if (subject)
- fprintf (out, "%sSubject: %s\n", resent ? "Resent-" : "", subject);
- if (from)
- fprintf (out, "%sFrom: %s\n", resent ? "Resent-" : "", from);
- if (!resent)
- fputs ("\n", out);
-
- if (body) {
- fprintf (out, "%s", body);
- if (*body && *(body + strlen (body) - 1) != '\n')
- fputs ("\n", out);
- } else {
- for (somebody = 0;
- (i = fread (buf, sizeof(*buf), sizeof(buf), stdin)) > 0;
- somebody++)
- if (fwrite (buf, sizeof(*buf), i, out) != i)
- adios (tmpfil, "error writing");
- if (!somebody) {
- unlink (tmpfil);
- done (1);
+
+ if (tolist == NULL)
+ adios(NULL, "usage: %s addrs ... [switches]", invo_name);
+
+ tfile = m_mktemp2("/tmp/", invo_name, NULL, &out);
+ if (tfile == NULL)
+ adios("mhmail", "unable to create temporary file");
+ chmod(tfile, 0600);
+ strncpy(tmpfil, tfile, sizeof(tmpfil));
+
+ SIGNAL2(SIGINT, intrser);
+
+ fprintf(out, "%sTo: %s\n", resent ? "Resent-" : "", tolist);
+ if (cclist)
+ fprintf(out, "%sCc: %s\n", resent ? "Resent-" : "", cclist);
+ if (subject)
+ fprintf(out, "%sSubject: %s\n", resent ? "Resent-" : "", subject);
+ if (from)
+ fprintf(out, "%sFrom: %s\n", resent ? "Resent-" : "", from);
+ if (!resent)
+ fputs("\n", out);
+
+ if (body) {
+ fprintf(out, "%s", body);
+ if (*body && *(body + strlen(body) - 1) != '\n')
+ fputs("\n", out);
+ } else {
+ for (somebody = 0; (i = fread(buf, sizeof(*buf), sizeof(buf),
+ stdin)) > 0; somebody++)
+ if (fwrite(buf, sizeof(*buf), i, out) != i)
+ adios(tmpfil, "error writing");
+ if (!somebody) {
+ unlink(tmpfil);
+ done(1);
+ }