oops, not for *nix
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 2 Jun 2003 11:04:49 +0000 (11:04 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 2 Jun 2003 11:04:49 +0000 (11:04 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2663 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCglue.c

index 9b58776a875091436ab962e67943a084aea3c1e7..c317fffcbece14dc441cfde531d84bf06d7c8e52 100644 (file)
@@ -1800,22 +1800,25 @@ tempfileandname(char *fname, size_t len)
 
   const char *tmpdir = NULL;
   int fd;
-  static int warning_emitted;
 
   if ((tmpdir = getenv ("TMP")) == NULL)
     if ((tmpdir = getenv ("TEMP")) == NULL)
       tmpdir = getenv ("TMPDIR");
 
 #if defined(_WIN32)
-  if (tmpdir == NULL)
-    {
-      tmpdir = "c:\\";
-      if (!warning_emitted)
-        {
-          fprintf (stderr, "TMP not defined in environment, using %s for temporary files\n", tmpdir);
-         warning_emitted = 1;
-       }
-    }
+  {
+    static int warning_emitted;
+
+    if (tmpdir == NULL)
+      {
+        tmpdir = "c:\\";
+        if (!warning_emitted)
+          {
+            fprintf (stderr, "TMP not defined in environment, using %s for temporary files\n.", tmpdir);
+           warning_emitted = 1;
+         }
+      }
+  }
 #else
   {
     /* try with /usr/tmp and /tmp on Un*x systems */
@@ -1826,10 +1829,6 @@ tempfileandname(char *fname, size_t len)
         tmpdir = "/usr/tmp";
       else if (stat("/tmp", &statbuf) != -1)
         tmpdir = "/tmp";
-      if (!warning_emitted)                                                                                                {
-          fprintf (stderr, "TMP not defined in environment, using %s for temporary files\n", tmpdir);
-          warning_emitted = 1;
-        }
     }
   }
 #endif