home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / updates / update18.zoo / patch / diffs < prev    next >
Encoding:
Text File  |  1992-03-20  |  7.9 KB  |  348 lines

  1. *** /home/bammi/etc/src/patch/common.h    Thu Mar 19 18:34:17 1992
  2. --- common.h    Fri Mar 20 18:30:38 1992
  3. ***************
  4. *** 54,64 ****
  5. --- 54,70 ----
  6.   #define MAXHUNKSIZE 100000        /* is this enough lines? */
  7.   #define INITHUNKMAX 125            /* initial dynamic allocation size */
  8.   #define MAXLINELEN 1024
  9. + #ifndef atarist
  10.   #define BUFFERSIZE 1024
  11.   #define SCCSPREFIX "s."
  12.   #define GET "get -e %s"
  13.   #define RCSSUFFIX ",v"
  14.   #define CHECKOUT "co -l %s"
  15. + #else
  16. + extern unsigned long __DEFAULT_BUFSIZ__;
  17. + #define BUFFERSIZE __DEFAULT_BUFSIZ__
  18. + #endif
  19.   
  20.   #ifdef FLEXFILENAMES
  21.   #define ORIGEXT ".orig"
  22. ***************
  23. *** 86,92 ****
  24. --- 92,103 ----
  25.   
  26.   typedef char bool;
  27.   typedef long LINENUM;            /* must be signed */
  28. + #ifndef atarist
  29.   typedef unsigned MEM;            /* what to feed malloc */
  30. + #else
  31. + #include <stddef.h>
  32. + typedef size_t MEM;            /* what to feed malloc */
  33. + #endif
  34.   
  35.   /* globals */
  36.   
  37. ***************
  38. *** 98,104 ****
  39. --- 109,119 ----
  40.   EXT struct stat filestat;        /* file statistics area */
  41.   EXT int filemode INIT(0644);
  42.   
  43. + #ifndef atarist
  44.   EXT char buf[MAXLINELEN];        /* general purpose buffer */
  45. + #else
  46. + EXT char buf[32768];            /* general purpose buffer */
  47. + #endif
  48.   EXT FILE *ofp INIT(Nullfp);        /* output file pointer */
  49.   EXT FILE *rejfp INIT(Nullfp);        /* reject file pointer */
  50.   
  51. ***************
  52. *** 151,156 ****
  53. --- 166,176 ----
  54.   
  55.   EXT char *revision INIT(Nullch);    /* prerequisite revision, if any */
  56.   
  57. + #ifdef NODIR
  58. + EXT char *simple_backup_suffix INIT("~");
  59. + #endif
  60. + #ifndef atarist
  61.   char *malloc();
  62.   char *realloc();
  63.   char *strcpy();
  64. ***************
  65. *** 158,163 ****
  66. --- 178,191 ----
  67.   long atol();
  68.   long lseek();
  69.   char *mktemp();
  70. + char *getenv();
  71. + #else
  72. + #include <string.h>
  73. + #include <memory.h>
  74. + #include <unistd.h>
  75. + EXT unsigned long __DEFAULT_BUFSIZ__ INIT(64*1024L);
  76. + #endif
  77.   #if 0
  78.   #ifdef CHARSPRINTF
  79.   char *sprintf();
  80. ***************
  81. *** 165,168 ****
  82.   int sprintf();
  83.   #endif
  84.   #endif
  85. - char *getenv();
  86. --- 193,195 ----
  87. *** /home/bammi/etc/src/patch/inp.c    Sun Jan 20 20:12:22 1991
  88. --- inp.c    Fri Mar 20 18:30:41 1992
  89. ***************
  90. *** 87,92 ****
  91. --- 87,93 ----
  92.       close(creat(filename, 0666));
  93.       }
  94.       if (stat(filename, &filestat) < 0) {
  95. + #ifndef atarist
  96.       Sprintf(buf, "RCS/%s%s", filename, RCSSUFFIX);
  97.       if (stat(buf, &filestat) >= 0 || stat(buf+4, &filestat) >= 0) {
  98.           Sprintf(buf, CHECKOUT, filename);
  99. ***************
  100. *** 110,115 ****
  101. --- 111,119 ----
  102.           else
  103.           fatal2("Can't find %s.\n", filename);
  104.       }
  105. + #else
  106. +     fatal2("Can't find %s.\n", filename);
  107. + #endif
  108.       }
  109.       filemode = filestat.st_mode;
  110.       if ((filemode & S_IFMT) & ~S_IFREG)
  111. *** /home/bammi/etc/src/patch/patch.c    Thu Mar 19 18:34:18 1992
  112. --- patch.c    Fri Mar 20 18:30:44 1992
  113. ***************
  114. *** 137,146 ****
  115. --- 137,151 ----
  116.       int failtotal = 0;
  117.       int i;
  118.   
  119. + #ifdef atarist
  120. +     _binmode(1);
  121. +     stdin->_flag |= _IOBIN;    /* sorry! */
  122. + #endif
  123.       setbuf(stderr, serrbuf);
  124.       for (i = 0; i<MAXFILEC; i++)
  125.       filearg[i] = Nullch;
  126.   
  127. + #ifndef atarist
  128.       /* Cons up the names of the temporary files.  */
  129.       {
  130.         /* Directory for temporary files.  */
  131. ***************
  132. *** 173,178 ****
  133. --- 178,218 ----
  134.         strcat (TMPPATNAME, "/patchpXXXXXX");
  135.         Mktemp(TMPPATNAME);
  136.       }
  137. + #else
  138. +     /* Cons up the names of the temporary files.  */
  139. +     {
  140. +       /* Directory for temporary files.  */
  141. +       char *tmpdir;
  142. +       size_t tmpname_len;
  143. +       if(!(tmpdir = getenv("TEMP")))
  144. +           tmpdir = getenv ("TMPDIR");
  145. +       if (tmpdir == NULL) {
  146. +     tmpdir = ".";
  147. +       }
  148. +       tmpname_len = strlen (tmpdir) + 20;
  149. +       TMPOUTNAME = (char *) malloc (tmpname_len);
  150. +       strcpy (TMPOUTNAME, tmpdir);
  151. +       strcat (TMPOUTNAME, "/poXXXXXX");
  152. +       Mktemp(TMPOUTNAME);
  153. +       TMPINNAME = (char *) malloc (tmpname_len);
  154. +       strcpy (TMPINNAME, tmpdir);
  155. +       strcat (TMPINNAME, "/piXXXXXX");
  156. +       Mktemp(TMPINNAME);
  157. +       TMPREJNAME = (char *) malloc (tmpname_len);
  158. +       strcpy (TMPREJNAME, tmpdir);
  159. +       strcat (TMPREJNAME, "/prXXXXXX");
  160. +       Mktemp(TMPREJNAME);
  161. +       TMPPATNAME = (char *) malloc (tmpname_len);
  162. +       strcpy (TMPPATNAME, tmpdir);
  163. +       strcat (TMPPATNAME, "/ppXXXXXX");
  164. +       Mktemp(TMPPATNAME);
  165. +     }
  166. + #endif
  167.   
  168.       /* parse switches */
  169.       Argc = argc;
  170. *** /home/bammi/etc/src/patch/pch.c    Tue Dec  3 11:27:06 1991
  171. --- pch.c    Fri Mar 20 18:30:47 1992
  172. ***************
  173. *** 728,738 ****
  174. --- 728,741 ----
  175.   
  176.       if (diff_type == CONTEXT_DIFF &&
  177.         (fillcnt || (p_first > 1 && ptrn_copiable > 2*p_context)) ) {
  178. + #ifndef atarist    /* unfortunately this is always true for TOS because of
  179. +            the ^M at the end of a line -- just ignore warning */
  180.           if (verbose)
  181.           say4("%s\n%s\n%s\n",
  182.   "(Fascinating--this is really a new-style context diff but without",
  183.   "the telltale extra asterisks on the *** line that usually indicate",
  184.   "the new style...)");
  185. + #endif
  186.           diff_type = NEW_CONTEXT_DIFF;
  187.       }
  188.       
  189. ***************
  190. *** 1239,1244 ****
  191. --- 1242,1248 ----
  192.       return p_hunk_beg;
  193.   }
  194.   
  195. + #ifndef atarist
  196.   /* Apply an ed script by feeding ed itself. */
  197.   
  198.   void
  199. ***************
  200. *** 1302,1304 ****
  201. --- 1306,1316 ----
  202.       chmod(outname, filemode);
  203.       set_signals(1);
  204.   }
  205. + #else
  206. + void
  207. + do_ed_script()
  208. + {
  209. +     fprintf(stderr,"Sorry! TOS version of Patch cannot deal with ed scripts\n");
  210. +     exit(999);
  211. + }
  212. + #endif
  213. No differences encountered
  214. *** /home/bammi/etc/src/patch/util.c    Thu Mar 19 18:34:20 1992
  215. --- util.c    Fri Mar 20 18:30:49 1992
  216. ***************
  217. *** 74,84 ****
  218. --- 74,88 ----
  219.       if (debug & 4)
  220.           say3("Moving %s to %s.\n", to, bakname);
  221.   #endif
  222. + #ifdef atarist
  223. +     copy_file(to, bakname);
  224. + #else
  225.       if (link(to, bakname) < 0) {
  226.           say3("patch: can't backup %s, output is in %s\n",
  227.           to, from);
  228.           return -1;
  229.       }
  230. + #endif
  231.       while (unlink(to) >= 0) ;
  232.       }
  233.   #ifdef DEBUGGING
  234. ***************
  235. *** 85,91 ****
  236. --- 89,100 ----
  237.       if (debug & 4)
  238.       say3("Moving %s to %s.\n", from, to);
  239.   #endif
  240. + #ifndef atarist
  241.       if (link(from, to) < 0) {        /* different file system? */
  242. + #else
  243. +     if (1) {
  244. + #endif
  245.       Reg4 int tofd;
  246.       
  247.       tofd = creat(to, 0666);
  248. ***************
  249. *** 205,210 ****
  250. --- 214,222 ----
  251.   
  252.       Sprintf(buf, pat, arg1, arg2, arg3);
  253.       Fflush(stderr);
  254. + #ifdef atarist
  255. +     r = _tos_ask(buf);
  256. + #else
  257.       write(2, buf, strlen(buf));
  258.       if (tty2) {                /* might be redirected to a file */
  259.       r = read(2, buf, sizeof buf);
  260. ***************
  261. *** 229,234 ****
  262. --- 241,247 ----
  263.       buf[0] = '\n';
  264.       r = 1;
  265.       }
  266. + #endif
  267.       if (r <= 0)
  268.       buf[0] = 0;
  269.       else
  270. ***************
  271. *** 364,369 ****
  272. --- 377,383 ----
  273.       Sprintf(tmpbuf, "RCS/%s", name);
  274.       free(s);
  275.       if (stat(name, &filestat) < 0 && !assume_exists) {
  276. + #ifndef atarist
  277.       Strcat(tmpbuf, RCSSUFFIX);
  278.       if (stat(tmpbuf, &filestat) < 0 && stat(tmpbuf+4, &filestat) < 0) {
  279.           Sprintf(tmpbuf, "SCCS/%s%s", SCCSPREFIX, name);
  280. ***************
  281. *** 372,377 ****
  282. --- 386,441 ----
  283.           name = Nullch;
  284.           }
  285.       }
  286. + #else
  287. +         free(name);
  288. +         name = Nullch;
  289. + #endif
  290.       }
  291.       return name;
  292.   }
  293. + /* this kludge is necessary because stdin is most likely re-directed
  294. +    and there is no way to read from CON: due to the braindamage
  295. +    in handles -- thanks Atari
  296. +  */
  297. + #ifdef atarist
  298. + #undef Fclose
  299. + #undef Fseek
  300. + #include <osbind.h>
  301. + int _tos_ask(buf)
  302. + char *buf;
  303. + {
  304. +     /* have to el-kludge it */
  305. +     int c;
  306. +     int r = 0;
  307. +     char *p = buf;
  308. +     write(2, buf, strlen(buf));
  309. +     while(( c = (Bconin(2) & 0x7f)) != '\r')
  310. +     {
  311. +     switch(c)
  312. +         {   /* we dont handle tabs/control chars nicely here */
  313. +         case 0:
  314. +         break;
  315. +         case '\b':
  316. +         case 0177:
  317. +         if(r > 0)
  318. +         { --p; --r; }
  319. +         Bconout(2, '\b'); Bconout(2, ' '); Bconout(2, '\b');
  320. +             break;
  321. +         default:
  322. +         if(c >= ' ')
  323. +         {
  324. +             *p++ = c; r++;
  325. +             Bconout(2, c);
  326. +         }
  327. +         /* else ignore control chars/tabs */
  328. +     }
  329. +     }
  330. +     Bconout(2, '\r');
  331. +     Bconout(2, '\n');
  332. +     *p++ = '\n'; *p = '\0';
  333. +     return r+1;
  334. + }
  335. + #endif
  336.