home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / msdos / djgpp / diffs / gcc-241 / gcc.c next >
Encoding:
Text File  |  1993-05-31  |  2.1 KB  |  92 lines

  1. *** orig/gcc-241/gcc.c    Sat May 29 21:17:02 1993
  2. --- src/gcc-241/gcc.c    Sat May 29 22:38:58 1993
  3. ***************
  4. *** 73,79 ****
  5.      because there's no place else we can expect to use.  */
  6.   #if __MSDOS__
  7.   #ifndef P_tmpdir
  8. ! #define P_tmpdir "./"
  9.   #endif
  10.   #endif
  11.   
  12. --- 73,79 ----
  13.      because there's no place else we can expect to use.  */
  14.   #if __MSDOS__
  15.   #ifndef P_tmpdir
  16. ! #define P_tmpdir "."
  17.   #endif
  18.   #endif
  19.   
  20. ***************
  21. *** 1330,1355 ****
  22.   /* Compute a string to use as the base of all temporary file names.
  23.      It is substituted for %g.  */
  24.   
  25.   static void
  26.   choose_temp_base ()
  27.   {
  28. !   char *base = getenv ("TMPDIR");
  29.     int len;
  30.   
  31. !   if (base == (char *)0)
  32. !     {
  33.   #ifdef P_tmpdir
  34. !       if (access (P_tmpdir, R_OK | W_OK) == 0)
  35. !     base = P_tmpdir;
  36.   #endif
  37. !       if (base == (char *)0)
  38. !     {
  39. !       if (access ("/usr/tmp", R_OK | W_OK) == 0)
  40. !         base = "/usr/tmp/";
  41. !       else
  42. !         base = "/tmp/";
  43. !     }
  44. !     }
  45.   
  46.     len = strlen (base);
  47.     temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
  48. --- 1330,1372 ----
  49.   /* Compute a string to use as the base of all temporary file names.
  50.      It is substituted for %g.  */
  51.   
  52. + static char *
  53. + choose_temp_base_try (try, base)
  54. + char *try;
  55. + char *base;
  56. + {
  57. +   char *rv;
  58. +   if (base)
  59. +     rv = base;
  60. +   else if (try == (char *)0)
  61. +     rv = 0;
  62. +   else if (access (try, R_OK | W_OK) != 0)
  63. +     rv = 0;
  64. +   else
  65. +     rv = try;
  66. +   return rv;
  67. + }
  68.   static void
  69.   choose_temp_base ()
  70.   {
  71. !   char *base = 0;
  72.     int len;
  73.   
  74. !   base = choose_temp_base_try (getenv ("TMPDIR"), base);
  75. !   base = choose_temp_base_try (getenv ("TMP"), base);
  76. !   base = choose_temp_base_try (getenv ("TEMP"), base);
  77.   #ifdef P_tmpdir
  78. !   base = choose_temp_base_try (P_tmpdir, base);
  79.   #endif
  80. !   base = choose_temp_base_try ("/usr/tmp", base);
  81. !   base = choose_temp_base_try ("/tmp", base);
  82. !   /* If all else fails, use the current directory! */  
  83. !   if (base == (char *)0)
  84. !     base = "./";
  85.   
  86.     len = strlen (base);
  87.     temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
  88.