From e0672a61706d24e0a297f833da964143ce7f3848 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 5 Jan 1998 00:25:39 +0000 Subject: [PATCH 1/1] (openfiles): [_WIN32 && !__CYGWIN32__] Use TEMP or Temp to find a temporary directory, if possible. Do not unlink files while they are open. --- src/files.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/files.c b/src/files.c index 1df92ec3..9fa9b4bb 100644 --- a/src/files.c +++ b/src/files.c @@ -133,6 +133,15 @@ openfiles() strlwr (infile); #endif /* MSDOS */ +#if (defined(_WIN32) && !defined(__CYGWIN32__)) + tmp_base = getenv ("TEMP"); /* Windows95 defines this ... */ + if (tmp_base == 0) + tmp_base = getenv ("Temp"); /* ... while NT prefers this */ + if (tmp_base == 0) + tmp_base = ""; + strlwr (infile); +#endif /* _WIN32 && !__CYGWIN32__ */ + tmp_len = strlen (tmp_base); if (spec_outfile) @@ -263,13 +272,13 @@ openfiles() fdefines = tryopen(tmpdefsfile, "w+"); } -#ifndef MSDOS +#if !(defined (MSDOS) || (defined(_WIN32) && !defined(__CYGWIN32__))) if (! noparserflag) unlink(actfile); unlink(tmpattrsfile); unlink(tmptabfile); unlink(tmpdefsfile); -#endif +#endif /* MSDOS || (_WIN32 && !__CYGWIN32__) */ /* These are opened by `done' or `open_extra_files', if at all */ if (spec_outfile) @@ -412,12 +421,12 @@ int k; if (k==0) sys$exit(SS$_NORMAL); sys$exit(SS$_ABORT); #else -#ifdef MSDOS +#if (defined (MSDOS) || (defined(_WIN32) && !defined(__CYGWIN32__))) if (actfile && ! noparserflag) unlink(actfile); if (tmpattrsfile) unlink(tmpattrsfile); if (tmptabfile) unlink(tmptabfile); if (tmpdefsfile) unlink(tmpdefsfile); -#endif /* MSDOS */ +#endif /* MSDOS || (_WIN32 && !__CYGWIN32__) */ exit(k); #endif /* not VMS, or __VMS_POSIX */ } -- 2.45.2