DEFINE_SWITCH_ARRAY(MIMEENCODING, encodingswitches);
#undef X
-/* mhbuildsbr.c */
-extern char *tmp; /* directory to place temp files */
-
/* mhcachesbr.c */
extern int rcachesw;
extern int wcachesw;
cache_private = ".cache";
cache_private = getcpy (m_maildir (cache_private));
- /*
- * Check for storage directory. If defined, we
- * will store temporary files there. Else we
- * store them in standard nmh directory.
- */
- if ((cp = context_find (nmhstorage)) && *cp)
- tmp = concat (cp, "/", invo_name, NULL);
- else
- tmp = add (m_maildir (invo_name), NULL);
-
if (!context_find ("path"))
free (path ("./", TFOLDER));
* Process the composition file from standard input.
*/
if (compfile[0] == '-' && compfile[1] == '\0') {
+ if ((cp = m_mktemp2(NULL, invo_name, NULL, &fp)) == NULL) {
+ adios(NULL, "unable to create temporary file in %s",
+ get_temp_dir());
+ }
+
/* copy standard input to temporary file */
- strncpy (infile, m_mktemp(invo_name, NULL, &fp), sizeof(infile));
+ strncpy (infile, cp, sizeof(infile));
while (fgets (buffer, BUFSIZ, stdin))
fputs (buffer, fp);
fclose (fp);
cts[1] = NULL;
/* output MIME message to this temporary file */
- strncpy(outfile, m_mktemp2(compfile, invo_name, NULL, &fp_out),
- sizeof(outfile));
+ if ((cp = m_mktemp2(compfile, invo_name, NULL, &fp_out)) == NULL) {
+ adios(NULL, "unable to create temporary file in %s", get_temp_dir());
+ }
+ strncpy(outfile, cp, sizeof(outfile));
unlink_outfile = 1;
/* output the message */