home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / dev / c / yacc / src / main.c.diff < prev    next >
Text File  |  1993-07-11  |  2KB  |  93 lines

  1. *** main.c.orig    Fri Jul 09 15:13:40 1993
  2. --- main.c    Sat Jul 10 18:32:18 1993
  3. ***************
  4. *** 230,241 ****
  5. --- 230,250 ----
  6.       char *tmpdir;
  7.   
  8.       tmpdir = getenv("TMPDIR");
  9. + #ifndef AMIGA
  10.       if (tmpdir == 0) tmpdir = "/tmp";
  11. + else
  12. +     if (tmpdir == 0) tmpdir = "T:";
  13. + #endif
  14.   
  15.       len = strlen(tmpdir);
  16.       i = len + 13;
  17. + #ifndef AMIGA
  18.       if (len && tmpdir[len-1] != '/')
  19.           ++i;
  20. + #else
  21. +     if (len && tmpdir[len-1] != '/' && tmpdir[len-1] != ':')
  22. +         ++i;
  23. + #endif
  24.   
  25.       action_file_name = MALLOC(i);
  26.       if (action_file_name == 0) no_space();
  27. ***************
  28. *** 248,253 ****
  29. --- 257,263 ----
  30.       strcpy(text_file_name, tmpdir);
  31.       strcpy(union_file_name, tmpdir);
  32.   
  33. + #ifndef AMIGA
  34.       if (len && tmpdir[len - 1] != '/')
  35.       {
  36.           action_file_name[len] = '/';
  37. ***************
  38. *** 255,260 ****
  39. --- 265,279 ----
  40.           union_file_name[len] = '/';
  41.           ++len;
  42.       }
  43. + #else
  44. +     if (len && tmpdir[len - 1] != '/' && tmpdir[len - 1] != ':')
  45. +     {
  46. +         action_file_name[len] = '/';
  47. +         text_file_name[len] = '/';
  48. +         union_file_name[len] = '/';
  49. +         ++len;
  50. +     }
  51. + #endif
  52.   
  53.       strcpy(action_file_name + len, temp_form);
  54.       strcpy(text_file_name + len, temp_form);
  55. ***************
  56. *** 375,377 ****
  57. --- 394,428 ----
  58.       done(0);
  59.       /*NOTREACHED*/
  60.   }
  61. + #ifdef AMIGA
  62. + extern char *strchr();
  63. + #define getpid(x)   ((int)FindTask(NULL))
  64. + const char amiga_version_string[] = "\0$VER: Berkeley yacc 1.9";
  65. + char *
  66. + mktemp(name)
  67. +     char *name;
  68. + {
  69. +     static int cnt;
  70. +     char *p, *q;
  71. +     int len;
  72. +     char buf[10];
  73. +     p = strchr(name, 'X');
  74. +     if( p ) {
  75. +         for( q = p+1; *q == 'X'; q++ )
  76. +             ;
  77. +         len = q - p;
  78. +         sprintf(buf, "%2x.%6x", cnt, getpid());
  79. +         strncpy(p, buf, len);
  80. +         cnt++;
  81. +     }
  82. +     return name;
  83. + }
  84. + #endif
  85.