- tempfile = alloca (20);
- *tempfile = '\0';
- }
- if (!IS_DIRECTORY_SEP (tempfile[strlen (tempfile) - 1]))
- strcat (tempfile, "/");
- if ('/' == DIRECTORY_SEP)
- dostounix_filename (tempfile);
- else
- unixtodos_filename (tempfile);
-#ifdef WINDOWSNT
- strcat (tempfile, "emXXXXXX");
-#else
- strcat (tempfile, "detmp.XXX");
+#ifndef DOS_NT
+ if (getenv ("TMPDIR"))
+ tmpdir = build_string (getenv ("TMPDIR"));
+ else
+ tmpdir = build_string ("/tmp/");
+#else /* DOS_NT */
+ char *outf;
+ if ((outf = egetenv ("TMPDIR"))
+ || (outf = egetenv ("TMP"))
+ || (outf = egetenv ("TEMP")))
+ tmpdir = build_string (outf);
+ else
+ tmpdir = Ffile_name_as_directory (build_string ("c:/temp"));