home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sources / bugs / 233 < prev    next >
Encoding:
Internet Message Format  |  1992-09-14  |  24.2 KB

  1. Path: sparky!uunet!usc!snorkelwacker.mit.edu!ai-lab!life!djm
  2. From: djm@gnu.ai.mit.edu (David J. MacKenzie)
  3. Newsgroups: comp.sources.bugs
  4. Subject: patch 12u8 to patch, part 01 of 02
  5. Message-ID: <DJM.92Sep15013438@nutrimat.gnu.ai.mit.edu>
  6. Date: 15 Sep 92 05:34:38 GMT
  7. Sender: news@ai.mit.edu
  8. Organization: Free Software Foundation
  9. Lines: 896
  10.  
  11. diff -C2 -N patch-2.0.12u7/patch.man patch-2.0.12u8/patch.man
  12. *** patch-2.0.12u7/patch.man    Sat Jul  4 04:47:57 1992
  13. --- patch-2.0.12u8/patch.man    Tue Aug 25 22:32:41 1992
  14. ***************
  15. *** 1,38 ****
  16.   .\" -*- nroff -*-
  17.   .rn '' }`
  18. ! ''' $Header: patch.man,v 2.0.1.2 88/06/22 20:47:18 lwall Locked $
  19. ! ''' 
  20. ! ''' $Log:    patch.man,v $
  21. ! ''' Revision 2.0.1.2  88/06/22  20:47:18  lwall
  22. ! ''' patch12: now avoids Bell System Logo
  23. ! ''' 
  24. ! ''' Revision 2.0.1.1  88/06/03  15:12:51  lwall
  25. ! ''' patch10: -B switch was contributed.
  26. ! ''' 
  27. ! ''' Revision 2.0  86/09/17  15:39:09  lwall
  28. ! ''' Baseline for netwide release.
  29. ! ''' 
  30. ! ''' Revision 1.4  86/08/01  19:23:22  lwall
  31. ! ''' Documented -v, -p, -F.
  32. ! ''' Added notes to patch senders.
  33. ! ''' 
  34. ! ''' Revision 1.3  85/03/26  15:11:06  lwall
  35. ! ''' Frozen.
  36. ! ''' 
  37. ! ''' Revision 1.2.1.4  85/03/12  16:14:27  lwall
  38. ! ''' Documented -p.
  39. ! ''' 
  40. ! ''' Revision 1.2.1.3  85/03/12  16:09:41  lwall
  41. ! ''' Documented -D.
  42. ! ''' 
  43. ! ''' Revision 1.2.1.2  84/12/05  11:06:55  lwall
  44. ! ''' Added -l switch, and noted bistability bug.
  45. ! ''' 
  46. ! ''' Revision 1.2.1.1  84/12/04  17:23:39  lwall
  47. ! ''' Branch for sdcrdcf changes.
  48. ! ''' 
  49. ! ''' Revision 1.2  84/12/04  17:22:02  lwall
  50. ! ''' Baseline version.
  51. ! ''' 
  52.   .de Sh
  53.   .br
  54. --- 1,38 ----
  55.   .\" -*- nroff -*-
  56.   .rn '' }`
  57. ! '\" $Header: patch.man,v 2.0.1.2 88/06/22 20:47:18 lwall Locked $
  58. ! '\" 
  59. ! '\" $Log:    patch.man,v $
  60. ! '\" Revision 2.0.1.2  88/06/22  20:47:18  lwall
  61. ! '\" patch12: now avoids Bell System Logo
  62. ! '\" 
  63. ! '\" Revision 2.0.1.1  88/06/03  15:12:51  lwall
  64. ! '\" patch10: -B switch was contributed.
  65. ! '\" 
  66. ! '\" Revision 2.0  86/09/17  15:39:09  lwall
  67. ! '\" Baseline for netwide release.
  68. ! '\" 
  69. ! '\" Revision 1.4  86/08/01  19:23:22  lwall
  70. ! '\" Documented -v, -p, -F.
  71. ! '\" Added notes to patch senders.
  72. ! '\" 
  73. ! '\" Revision 1.3  85/03/26  15:11:06  lwall
  74. ! '\" Frozen.
  75. ! '\" 
  76. ! '\" Revision 1.2.1.4  85/03/12  16:14:27  lwall
  77. ! '\" Documented -p.
  78. ! '\" 
  79. ! '\" Revision 1.2.1.3  85/03/12  16:09:41  lwall
  80. ! '\" Documented -D.
  81. ! '\" 
  82. ! '\" Revision 1.2.1.2  84/12/05  11:06:55  lwall
  83. ! '\" Added -l switch, and noted bistability bug.
  84. ! '\" 
  85. ! '\" Revision 1.2.1.1  84/12/04  17:23:39  lwall
  86. ! '\" Branch for sdcrdcf changes.
  87. ! '\" 
  88. ! '\" Revision 1.2  84/12/04  17:22:02  lwall
  89. ! '\" Baseline version.
  90. ! '\" 
  91.   .de Sh
  92.   .br
  93. ***************
  94. *** 46,54 ****
  95.   .if n .sp
  96.   ..
  97. ! '''
  98. ! '''     Set up \*(-- to give an unbreakable dash;
  99. ! '''     string Tr holds user defined translation string.
  100. ! '''     Bell System Logo is used as a dummy character.
  101. ! '''
  102.   .ie n \{\
  103.   .tr \(*W-\*(Tr
  104. --- 46,56 ----
  105.   .if n .sp
  106.   ..
  107. ! '\"
  108. ! '\"     Set up \*(-- to give an unbreakable dash;
  109. ! '\"     string Tr holds user defined translation string.
  110. ! '\"     Bell System Logo is used as a dummy character.
  111. ! '\"
  112. ! '\" Shut up a groff -ww warning.
  113. ! .if \n(.g .if !dTr .ds Tr
  114.   .ie n \{\
  115.   .tr \(*W-\*(Tr
  116. ***************
  117. *** 71,78 ****
  118.   .TH PATCH 1 LOCAL
  119.   .SH NAME
  120. ! patch - a program for applying a diff file to an original
  121.   .SH SYNOPSIS
  122.   .B patch
  123. ! [options] orig patchfile [+ [options] orig]
  124.   .sp
  125.   but usually just
  126. --- 73,80 ----
  127.   .TH PATCH 1 LOCAL
  128.   .SH NAME
  129. ! patch - apply a diff file to an original
  130.   .SH SYNOPSIS
  131.   .B patch
  132. ! [options] [origfile [patchfile]] [+ [options] [origfile]]...
  133.   .sp
  134.   but usually just
  135. ***************
  136. *** 108,114 ****
  137.   backup file that does not already exist.
  138.   .PP
  139. - .I patch
  140. - removes output files that are empty after being patched.
  141. - .PP
  142.   You may also specify where you want the output to go with a
  143.   .B -o
  144. --- 110,113 ----
  145. ***************
  146. *** 274,277 ****
  147. --- 273,281 ----
  148.   to interpret the patch file as an ed script.
  149.   .TP 5
  150. + .B \-E
  151. + causes
  152. + .I patch
  153. + to remove output files that are empty after the patches have been applied.
  154. + .TP 5
  155.   .B \-f
  156.   forces
  157. ***************
  158. *** 278,286 ****
  159.   .I patch
  160.   to assume that the user knows exactly what he or she is doing, and to not
  161. ! ask any questions.
  162. ! It does not suppress commentary, however.
  163. ! Use
  164.   .B \-s
  165.   for that.
  166.   .TP 5
  167.   .B \-F<number>
  168. --- 282,301 ----
  169.   .I patch
  170.   to assume that the user knows exactly what he or she is doing, and to not
  171. ! ask any questions.  It assumes the following: skip patches for which a
  172. ! file to patch can't be found; patch files even though they have the
  173. ! wrong version for the ``Prereq:'' line in the patch; and assume that
  174. ! patches are not reversed even if they look like they are.
  175. ! This option does not suppress commentary; use
  176.   .B \-s
  177.   for that.
  178. + .TP 5
  179. + .B \-t
  180. + similar to
  181. + .BR \-f ,
  182. + in that it suppresses questions, but makes some different assumptions:
  183. + skip patches for which a file to patch can't be found (the same as \fB\-f\fP);
  184. + skip patches for which the file has the wrong version for the ``Prereq:'' line
  185. + in the patch; and assume that patches are reversed if they look like
  186. + they are.
  187.   .TP 5
  188.   .B \-F<number>
  189. diff -C2 -N patch-2.0.12u7/pch.c patch-2.0.12u8/pch.c
  190. *** patch-2.0.12u7/pch.c    Tue Dec  3 11:27:06 1991
  191. --- patch-2.0.12u8/pch.c    Tue Aug 25 22:28:23 1992
  192. ***************
  193. *** 86,90 ****
  194.       pfp = fopen(TMPPATNAME, "w");
  195.       if (pfp == Nullfp)
  196. !         fatal2("patch: can't create %s.\n", TMPPATNAME);
  197.       while (fgets(buf, sizeof buf, stdin) != Nullch)
  198.           fputs(buf, pfp);
  199. --- 86,90 ----
  200.       pfp = fopen(TMPPATNAME, "w");
  201.       if (pfp == Nullfp)
  202. !         pfatal2("can't create %s", TMPPATNAME);
  203.       while (fgets(buf, sizeof buf, stdin) != Nullch)
  204.           fputs(buf, pfp);
  205. ***************
  206. *** 94,98 ****
  207.       pfp = fopen(filename, "r");
  208.       if (pfp == Nullfp)
  209. !     fatal2("patch file %s not found\n", filename);
  210.       Fstat(fileno(pfp), &filestat);
  211.       p_filesize = filestat.st_size;
  212. --- 94,98 ----
  213.       pfp = fopen(filename, "r");
  214.       if (pfp == Nullfp)
  215. !     pfatal2("patch file %s not found", filename);
  216.       Fstat(fileno(pfp), &filestat);
  217.       p_filesize = filestat.st_size;
  218. ***************
  219. *** 136,140 ****
  220.       return;
  221.       if (!using_plan_a)
  222. !     fatal1("patch: out of memory (grow_hunkmax)\n");
  223.       out_of_mem = TRUE;        /* whatever is null will be allocated again */
  224.                   /* from within plan_a(), of all places */
  225. --- 136,140 ----
  226.       return;
  227.       if (!using_plan_a)
  228. !     fatal1("out of memory\n");
  229.       out_of_mem = TRUE;        /* whatever is null will be allocated again */
  230.                   /* from within plan_a(), of all places */
  231. ***************
  232. *** 175,179 ****
  233.       skip_to(p_start,p_sline);
  234.       while (filearg[0] == Nullch) {
  235. !     if (force) {
  236.           say1("No file to patch.  Skipping...\n");
  237.           filearg[0] = savestr(bestguess);
  238. --- 175,179 ----
  239.       skip_to(p_start,p_sline);
  240.       while (filearg[0] == Nullch) {
  241. !     if (force || batch) {
  242.           say1("No file to patch.  Skipping...\n");
  243.           filearg[0] = savestr(bestguess);
  244. ***************
  245. *** 427,431 ****
  246.   malformed ()
  247.   {
  248. !     fatal3("Malformed patch at line %ld: %s", p_input_line, buf);
  249.           /* about as informative as "Syntax error" in C */
  250.   }
  251. --- 427,431 ----
  252.   malformed ()
  253.   {
  254. !     fatal3("malformed patch at line %ld: %s", p_input_line, buf);
  255.           /* about as informative as "Syntax error" in C */
  256.   }
  257. ***************
  258. *** 488,492 ****
  259.               goto hunk_done;
  260.               }
  261. !             fatal1("Unexpected end of file in patch.\n");
  262.           }
  263.           }
  264. --- 488,492 ----
  265.               goto hunk_done;
  266.               }
  267. !             fatal1("unexpected end of file in patch\n");
  268.           }
  269.           }
  270. ***************
  271. *** 507,511 ****
  272.               }
  273.               else
  274. !             fatal2("Unexpected end of hunk at line %ld.\n",
  275.                   p_input_line);
  276.           }
  277. --- 507,511 ----
  278.               }
  279.               else
  280. !             fatal2("unexpected end of hunk at line %ld\n",
  281.                   p_input_line);
  282.           }
  283. ***************
  284. *** 515,519 ****
  285.               goto hunk_done;
  286.               }
  287. !             fatal3("Unexpected *** at line %ld: %s", p_input_line, buf);
  288.           }
  289.           context = 0;
  290. --- 515,519 ----
  291.               goto hunk_done;
  292.               }
  293. !             fatal3("unexpected *** at line %ld: %s", p_input_line, buf);
  294.           }
  295.           context = 0;
  296. ***************
  297. *** 567,571 ****
  298.                   }
  299.                   fatal3(
  300. ! "Duplicate \"---\" at line %ld--check line numbers at line %ld.\n",
  301.                       p_input_line, p_hunk_beg + repl_beginning);
  302.                   }
  303. --- 567,571 ----
  304.                   }
  305.                   fatal3(
  306. ! "duplicate \"---\" at line %ld--check line numbers at line %ld\n",
  307.                       p_input_line, p_hunk_beg + repl_beginning);
  308.                   }
  309. ***************
  310. *** 572,576 ****
  311.                   else {
  312.                   fatal4(
  313. ! "%s \"---\" at line %ld--check line numbers at line %ld.\n",
  314.                       (p_end <= p_ptrn_lines
  315.                       ? "Premature"
  316. --- 572,576 ----
  317.                   else {
  318.                   fatal4(
  319. ! "%s \"---\" at line %ld--check line numbers at line %ld\n",
  320.                       (p_end <= p_ptrn_lines
  321.                       ? "Premature"
  322. ***************
  323. *** 608,612 ****
  324.               p_max = p_repl_lines + p_end;
  325.               if (p_max > MAXHUNKSIZE)
  326. !             fatal4("Hunk too large (%ld lines) at line %ld: %s",
  327.                     p_max, p_input_line, buf);
  328.               while (p_max >= hunkmax)
  329. --- 608,612 ----
  330.               p_max = p_repl_lines + p_end;
  331.               if (p_max > MAXHUNKSIZE)
  332. !             fatal4("hunk too large (%ld lines) at line %ld: %s",
  333.                     p_max, p_input_line, buf);
  334.               while (p_max >= hunkmax)
  335. ***************
  336. *** 690,694 ****
  337.       hunk_done:
  338.       if (p_end >=0 && !repl_beginning)
  339. !         fatal2("No --- found in patch at line %ld\n", pch_hunk_beg());
  340.   
  341.       if (repl_missing) {
  342. --- 690,694 ----
  343.       hunk_done:
  344.       if (p_end >=0 && !repl_beginning)
  345. !         fatal2("no --- found in patch at line %ld\n", pch_hunk_beg());
  346.   
  347.       if (repl_missing) {
  348. ***************
  349. *** 720,724 ****
  350.           filldst++;
  351.           }
  352. ! /*        repl_beginning--;        /* this doesn't need to be fixed */
  353.           p_end--;
  354.           p_first++;            /* do append rather than insert */
  355. --- 720,726 ----
  356.           filldst++;
  357.           }
  358. ! #if 0
  359. !         repl_beginning--;        /* this doesn't need to be fixed */
  360. ! #endif
  361.           p_end--;
  362.           p_first++;            /* do append rather than insert */
  363. ***************
  364. *** 745,749 ****
  365.               fillsrc++;
  366.           if (fillsrc > p_end)
  367. !             fatal2("Replacement text or line numbers mangled in hunk at line %ld\n",
  368.               p_hunk_beg);
  369.           p_line[filldst] = p_line[fillsrc];
  370. --- 747,751 ----
  371.               fillsrc++;
  372.           if (fillsrc > p_end)
  373. !             fatal2("replacement text or line numbers mangled in hunk at line %ld\n",
  374.               p_hunk_beg);
  375.           p_line[filldst] = p_line[fillsrc];
  376. ***************
  377. *** 833,837 ****
  378.               Strcpy(buf, " \n");  /* assume blank lines got chopped */
  379.           else {
  380. !             fatal1("Unexpected end of file in patch.\n");
  381.           }
  382.           }
  383. --- 835,839 ----
  384.               Strcpy(buf, " \n");  /* assume blank lines got chopped */
  385.           else {
  386. !             fatal1("unexpected end of file in patch\n");
  387.           }
  388.           }
  389. ***************
  390. *** 941,945 ****
  391.       p_end = p_ptrn_lines + 1 + max - min + 1;
  392.       if (p_end > MAXHUNKSIZE)
  393. !         fatal4("Hunk too large (%ld lines) at line %ld: %s",
  394.             p_end, p_input_line, buf);
  395.       while (p_end >= hunkmax)
  396. --- 943,947 ----
  397.       p_end = p_ptrn_lines + 1 + max - min + 1;
  398.       if (p_end > MAXHUNKSIZE)
  399. !         fatal4("hunk too large (%ld lines) at line %ld: %s",
  400.             p_end, p_input_line, buf);
  401.       while (p_end >= hunkmax)
  402. ***************
  403. *** 958,965 ****
  404.           p_input_line++;
  405.           if (ret == Nullch)
  406. !         fatal2("Unexpected end of file in patch at line %ld.\n",
  407.             p_input_line);
  408.           if (*buf != '<')
  409. !         fatal2("< expected at line %ld of patch.\n", p_input_line);
  410.           p_line[i] = savestr(buf+2);
  411.           if (out_of_mem) {
  412. --- 960,967 ----
  413.           p_input_line++;
  414.           if (ret == Nullch)
  415. !         fatal2("unexpected end of file in patch at line %ld\n",
  416.             p_input_line);
  417.           if (*buf != '<')
  418. !         fatal2("< expected at line %ld of patch\n", p_input_line);
  419.           p_line[i] = savestr(buf+2);
  420.           if (out_of_mem) {
  421. ***************
  422. *** 974,981 ****
  423.           p_input_line++;
  424.           if (ret == Nullch)
  425. !         fatal2("Unexpected end of file in patch at line %ld.\n",
  426.               p_input_line);
  427.           if (*buf != '-')
  428. !         fatal2("--- expected at line %ld of patch.\n", p_input_line);
  429.       }
  430.       Sprintf(buf, "--- %ld,%ld\n", min, max);
  431. --- 976,983 ----
  432.           p_input_line++;
  433.           if (ret == Nullch)
  434. !         fatal2("unexpected end of file in patch at line %ld\n",
  435.               p_input_line);
  436.           if (*buf != '-')
  437. !         fatal2("--- expected at line %ld of patch\n", p_input_line);
  438.       }
  439.       Sprintf(buf, "--- %ld,%ld\n", min, max);
  440. ***************
  441. *** 990,997 ****
  442.           p_input_line++;
  443.           if (ret == Nullch)
  444. !         fatal2("Unexpected end of file in patch at line %ld.\n",
  445.               p_input_line);
  446.           if (*buf != '>')
  447. !         fatal2("> expected at line %ld of patch.\n", p_input_line);
  448.           p_line[i] = savestr(buf+2);
  449.           if (out_of_mem) {
  450. --- 992,999 ----
  451.           p_input_line++;
  452.           if (ret == Nullch)
  453. !         fatal2("unexpected end of file in patch at line %ld\n",
  454.               p_input_line);
  455.           if (*buf != '>')
  456. !         fatal2("> expected at line %ld of patch\n", p_input_line);
  457.           p_line[i] = savestr(buf+2);
  458.           if (out_of_mem) {
  459. ***************
  460. *** 1249,1253 ****
  461.       Reg3 bool this_line_is_command = FALSE;
  462.       Reg4 FILE *pipefp;
  463. -     FILE *popen();
  464.   
  465.       if (!skip_rest_of_patch) {
  466. --- 1251,1254 ----
  467. diff -C2 -N patch-2.0.12u7/util.c patch-2.0.12u8/util.c
  468. *** patch-2.0.12u7/util.c    Mon Jul  6 15:25:27 1992
  469. --- patch-2.0.12u8/util.c    Mon Sep 14 22:04:46 1992
  470. ***************
  471. *** 5,8 ****
  472. --- 5,23 ----
  473.   #include "backupfile.h"
  474.   
  475. + void my_exit();
  476. + static char *
  477. + private_strerror (errnum)
  478. +      int errnum;
  479. + {
  480. +   extern char *sys_errlist[];
  481. +   extern int sys_nerr;
  482. +   if (errnum > 0 && errnum <= sys_nerr)
  483. +     return sys_errlist[errnum];
  484. +   return "Unknown system error";
  485. + }
  486. + #define strerror private_strerror
  487.   /* Rename a file, copying it if necessary. */
  488.   
  489. ***************
  490. *** 25,32 ****
  491.       fromfd = open(from, 0);
  492.       if (fromfd < 0)
  493. !         fatal2("patch: internal error, can't reopen %s\n", from);
  494.       while ((i=read(fromfd, buf, sizeof buf)) > 0)
  495.           if (write(1, buf, i) != 1)
  496. !         fatal1("patch: write failed\n");
  497.       Close(fromfd);
  498.       return 0;
  499. --- 40,47 ----
  500.       fromfd = open(from, 0);
  501.       if (fromfd < 0)
  502. !         pfatal2("internal error, can't reopen %s", from);
  503.       while ((i=read(fromfd, buf, sizeof buf)) > 0)
  504.           if (write(1, buf, i) != 1)
  505. !         pfatal1("write failed");
  506.       Close(fromfd);
  507.       return 0;
  508. ***************
  509. *** 40,44 ****
  510.       char *backupname = find_backup_file_name(to);
  511.       if (backupname == (char *) 0)
  512. !         fatal1("Can't seem to get enough memory.\n");
  513.       Strcpy(bakname, backupname);
  514.       free(backupname);
  515. --- 55,59 ----
  516.       char *backupname = find_backup_file_name(to);
  517.       if (backupname == (char *) 0)
  518. !         fatal1("out of memory\n");
  519.       Strcpy(bakname, backupname);
  520.       free(backupname);
  521. ***************
  522. *** 49,53 ****
  523.       }
  524.   
  525. !     if (stat(to, &filestat) >= 0) {    /* output file exists */
  526.       dev_t to_device = filestat.st_dev;
  527.       ino_t to_inode  = filestat.st_ino;
  528. --- 64,68 ----
  529.       }
  530.   
  531. !     if (stat(to, &filestat) == 0) {    /* output file exists */
  532.       dev_t to_device = filestat.st_dev;
  533.       ino_t to_inode  = filestat.st_ino;
  534. ***************
  535. *** 61,65 ****
  536.          Change the first lowercase char into uppercase;
  537.          if that isn't sufficient, chop off the first char and try again.  */
  538. !     while (stat(bakname, &filestat) >= 0 &&
  539.           to_device == filestat.st_dev && to_inode == filestat.st_ino) {
  540.           /* Skip initial non-lowercase chars.  */
  541. --- 76,80 ----
  542.          Change the first lowercase char into uppercase;
  543.          if that isn't sufficient, chop off the first char and try again.  */
  544. !     while (stat(bakname, &filestat) == 0 &&
  545.           to_device == filestat.st_dev && to_inode == filestat.st_ino) {
  546.           /* Skip initial non-lowercase chars.  */
  547. ***************
  548. *** 84,88 ****
  549.           bakfd = creat(bakname, 0666);
  550.           if (bakfd < 0) {
  551. !         say3("patch: can't backup %s, output is in %s.\n", to, from);
  552.           return -1;
  553.           }
  554. --- 99,104 ----
  555.           bakfd = creat(bakname, 0666);
  556.           if (bakfd < 0) {
  557. !         say4("Can't backup %s, output is in %s: %s\n", to, from,
  558. !              strerror(errno));
  559.           return -1;
  560.           }
  561. ***************
  562. *** 89,96 ****
  563.           tofd = open(to, 0);
  564.           if (tofd < 0)
  565. !         fatal2("patch: internal error, can't open %s\n", to);
  566.           while ((i=read(tofd, buf, sizeof buf)) > 0)
  567.           if (write(bakfd, buf, i) != i)
  568. !             fatal1("patch: write failed\n");
  569.           Close(tofd);
  570.           Close(bakfd);
  571. --- 105,112 ----
  572.           tofd = open(to, 0);
  573.           if (tofd < 0)
  574. !         pfatal2("internal error, can't open %s", to);
  575.           while ((i=read(tofd, buf, sizeof buf)) > 0)
  576.           if (write(bakfd, buf, i) != i)
  577. !             pfatal1("write failed");
  578.           Close(tofd);
  579.           Close(bakfd);
  580. ***************
  581. *** 107,112 ****
  582.       tofd = creat(to, 0666);
  583.       if (tofd < 0) {
  584. !         say3("patch: can't create %s, output is in %s.\n",
  585. !           to, from);
  586.           return -1;
  587.       }
  588. --- 123,128 ----
  589.       tofd = creat(to, 0666);
  590.       if (tofd < 0) {
  591. !         say4("Can't create %s, output is in %s: %s\n",
  592. !           to, from, strerror(errno));
  593.           return -1;
  594.       }
  595. ***************
  596. *** 113,120 ****
  597.       fromfd = open(from, 0);
  598.       if (fromfd < 0)
  599. !         fatal2("patch: internal error, can't reopen %s\n", from);
  600.       while ((i=read(fromfd, buf, sizeof buf)) > 0)
  601.           if (write(tofd, buf, i) != i)
  602. !         fatal1("patch: write failed\n");
  603.       Close(fromfd);
  604.       Close(tofd);
  605. --- 129,136 ----
  606.       fromfd = open(from, 0);
  607.       if (fromfd < 0)
  608. !         pfatal2("internal error, can't reopen %s", from);
  609.       while ((i=read(fromfd, buf, sizeof buf)) > 0)
  610.           if (write(tofd, buf, i) != i)
  611. !         pfatal1("write failed");
  612.       Close(fromfd);
  613.       Close(tofd);
  614. ***************
  615. *** 136,146 ****
  616.       tofd = creat(to, 0666);
  617.       if (tofd < 0)
  618. !     fatal2("patch: can't create %s.\n", to);
  619.       fromfd = open(from, 0);
  620.       if (fromfd < 0)
  621. !     fatal2("patch: internal error, can't reopen %s\n", from);
  622.       while ((i=read(fromfd, buf, sizeof buf)) > 0)
  623.       if (write(tofd, buf, i) != i)
  624. !         fatal2("patch: write (%s) failed\n", to);
  625.       Close(fromfd);
  626.       Close(tofd);
  627. --- 152,162 ----
  628.       tofd = creat(to, 0666);
  629.       if (tofd < 0)
  630. !     pfatal2("can't create %s", to);
  631.       fromfd = open(from, 0);
  632.       if (fromfd < 0)
  633. !     pfatal2("internal error, can't reopen %s", from);
  634.       while ((i=read(fromfd, buf, sizeof buf)) > 0)
  635.       if (write(tofd, buf, i) != i)
  636. !         pfatal2("write to %s failed", to);
  637.       Close(fromfd);
  638.       Close(tofd);
  639. ***************
  640. *** 165,169 ****
  641.           out_of_mem = TRUE;
  642.       else
  643. !         fatal1("patch: out of memory (savestr)\n");
  644.       }
  645.       else {
  646. --- 181,185 ----
  647.           out_of_mem = TRUE;
  648.       else
  649. !         fatal1("out of memory\n");
  650.       }
  651.       else {
  652. ***************
  653. *** 181,184 ****
  654. --- 197,202 ----
  655.   fatal(pat) char *pat; { ; }
  656.   /*VARARGS ARGSUSED*/
  657. + pfatal(pat) char *pat; { ; }
  658. + /*VARARGS ARGSUSED*/
  659.   ask(pat) char *pat; { ; }
  660.   
  661. ***************
  662. *** 203,209 ****
  663.   long arg1,arg2,arg3;
  664.   {
  665. !     void my_exit();
  666.   
  667. !     say(pat, arg1, arg2, arg3);
  668.       my_exit(1);
  669.   }
  670. --- 221,241 ----
  671.   long arg1,arg2,arg3;
  672.   {
  673. !     fprintf(stderr, "patch: **** ");
  674. !     fprintf(stderr, pat, arg1, arg2, arg3);
  675. !     my_exit(1);
  676. ! }
  677. ! /* Say something from patch, something from the system, then silence . . . */
  678. ! void                /* very void */
  679. ! pfatal(pat,arg1,arg2,arg3)
  680. ! char *pat;
  681. ! long arg1,arg2,arg3;
  682. ! {
  683. !     int errnum = errno;
  684.   
  685. !     fprintf(stderr, "patch: **** ");
  686. !     fprintf(stderr, pat, arg1, arg2, arg3);
  687. !     fprintf(stderr, ": %s\n", strerror(errnum));
  688.       my_exit(1);
  689.   }
  690. ***************
  691. *** 261,265 ****
  692.   int reset;
  693.   {
  694. -     void my_exit();
  695.   #ifndef lint
  696.   #ifdef VOIDSIG
  697. --- 293,296 ----
  698. ***************
  699. *** 301,305 ****
  700.   }
  701.   
  702. ! /* Make sure we'll have the directories to create a file. */
  703.   
  704.   void
  705. --- 332,337 ----
  706.   }
  707.   
  708. ! /* Make sure we'll have the directories to create a file.
  709. !    If `striplast' is TRUE, ignore the last element of `filename'.  */
  710.   
  711.   void
  712. ***************
  713. *** 310,317 ****
  714.       char tmpbuf[256];
  715.       Reg2 char *s = tmpbuf;
  716. !     char *dirv[20];
  717.       Reg3 int i;
  718. !     Reg4 int dirvp = 0;
  719.   
  720.       while (*filename) {
  721.       if (*filename == '/') {
  722. --- 342,351 ----
  723.       char tmpbuf[256];
  724.       Reg2 char *s = tmpbuf;
  725. !     char *dirv[20];        /* Point to the NULs between elements.  */
  726.       Reg3 int i;
  727. !     Reg4 int dirvp = 0;        /* Number of finished entries in dirv. */
  728.   
  729. +     /* Copy `filename' into `tmpbuf' with a NUL instead of a slash
  730. +        between the directories.  */
  731.       while (*filename) {
  732.       if (*filename == '/') {
  733. ***************
  734. *** 330,342 ****
  735.       if (dirvp < 0)
  736.       return;
  737.       strcpy(buf, "mkdir");
  738.       s = buf;
  739.       for (i=0; i<=dirvp; i++) {
  740. !     while (*s) s++;
  741. !     *s++ = ' ';
  742. !     strcpy(s, tmpbuf);
  743.       *dirv[i] = '/';
  744.       }
  745. !     system(buf);
  746.   }
  747.   
  748. --- 364,382 ----
  749.       if (dirvp < 0)
  750.       return;
  751.       strcpy(buf, "mkdir");
  752.       s = buf;
  753.       for (i=0; i<=dirvp; i++) {
  754. !     struct stat sbuf;
  755. !     if (stat(tmpbuf, &sbuf) && errno == ENOENT) {
  756. !         while (*s) s++;
  757. !         *s++ = ' ';
  758. !         strcpy(s, tmpbuf);
  759. !     }
  760.       *dirv[i] = '/';
  761.       }
  762. !     if (s != buf)
  763. !     system(buf);
  764.   }
  765.   
  766. ***************
  767. *** 380,384 ****
  768.       if (strip_leading == 957 && name != fullname && *fullname != '/') {
  769.       name[-1] = '\0';
  770. !     if (stat(fullname, &filestat) >= 0 && S_ISDIR (filestat.st_mode)) {
  771.           name[-1] = '/';
  772.           name=fullname;
  773. --- 420,424 ----
  774.       if (strip_leading == 957 && name != fullname && *fullname != '/') {
  775.       name[-1] = '\0';
  776. !     if (stat(fullname, &filestat) == 0 && S_ISDIR (filestat.st_mode)) {
  777.           name[-1] = '/';
  778.           name=fullname;
  779. ***************
  780. *** 389,402 ****
  781.       free(fullname);
  782.   
  783. !     if (stat(name, &filestat) < 0 && !assume_exists) {
  784. !         Sprintf(tmpbuf, "RCS/%s%s", name, RCSSUFFIX);
  785. !     if (stat(tmpbuf, &filestat) < 0 && stat(tmpbuf+4, &filestat) < 0) {
  786. !         Sprintf(tmpbuf, "SCCS/%s%s", SCCSPREFIX, name);
  787. !         if (stat(tmpbuf, &filestat) < 0 && stat(tmpbuf+5, &filestat) < 0) {
  788. !         free(name);
  789. !         name = Nullch;
  790. !         }
  791. !     }
  792.       }
  793.       return name;
  794.   }
  795. --- 429,450 ----
  796.       free(fullname);
  797.   
  798. !     if (stat(name, &filestat) && !assume_exists) {
  799. !     char *filebase = basename(name);
  800. !     int pathlen = filebase - name;
  801. !     /* Put any leading path into `tmpbuf'.  */
  802. !     strncpy(tmpbuf, name, pathlen);
  803. ! #define try(f, a1, a2) (Sprintf(tmpbuf + pathlen, f, a1, a2), stat(tmpbuf, &filestat) == 0)
  804. !     if (   try("RCS/%s%s", filebase, RCSSUFFIX)
  805. !         || try("RCS/%s"  , filebase,         0)
  806. !         || try(    "%s%s", filebase, RCSSUFFIX)
  807. !         || try("SCCS/%s%s", SCCSPREFIX, filebase)
  808. !         || try(     "%s%s", SCCSPREFIX, filebase))
  809. !       return name;
  810. !     free(name);
  811. !     name = Nullch;
  812.       }
  813.       return name;
  814.   }
  815. diff -C2 -N patch-2.0.12u7/util.h patch-2.0.12u8/util.h
  816. *** patch-2.0.12u7/util.h    Wed Aug 15 01:13:39 1990
  817. --- patch-2.0.12u8/util.h    Mon Jul 20 14:20:24 1992
  818. ***************
  819. *** 23,26 ****
  820. --- 23,30 ----
  821.   #define fatal3 fatal
  822.   #define fatal4 fatal
  823. + #define pfatal1 pfatal
  824. + #define pfatal2 pfatal
  825. + #define pfatal3 pfatal
  826. + #define pfatal4 pfatal
  827.   
  828.   #else /* hope they allow multi-line macro actual arguments */
  829. ***************
  830. *** 40,43 ****
  831. --- 44,51 ----
  832.   #define fatal3(a,b,c) fatal(a, (b)==(b), (c)==(c), 0)
  833.   #define fatal4(a,b,c,d) fatal(a, (b)==(b), (c)==(c), (d)==(d))
  834. + #define pfatal1(a) pfatal(a, 0, 0, 0)
  835. + #define pfatal2(a,b) pfatal(a, (b)==(b), 0, 0)
  836. + #define pfatal3(a,b,c) pfatal(a, (b)==(b), (c)==(c), 0)
  837. + #define pfatal4(a,b,c,d) pfatal(a, (b)==(b), (c)==(c), (d)==(d))
  838.   
  839.   #else /* lint */
  840. ***************
  841. *** 55,58 ****
  842. --- 63,70 ----
  843.   #define fatal3(a,b,c) fatal(a, b, c, Nullch)
  844.   #define fatal4 fatal
  845. + #define pfatal1(a) pfatal(a, Nullch, Nullch, Nullch)
  846. + #define pfatal2(a,b) pfatal(a, b, Nullch, Nullch)
  847. + #define pfatal3(a,b,c) pfatal(a, b, c, Nullch)
  848. + #define pfatal4 pfatal
  849.   
  850.   #endif /* lint */
  851. ***************
  852. *** 68,71 ****
  853. --- 80,84 ----
  854.   void say();
  855.   void fatal();
  856. + void pfatal();
  857.   void ask();
  858.   char *savestr();
  859. ***************
  860. *** 73,74 ****
  861. --- 86,88 ----
  862.   void ignore_signals();
  863.   void makedirs();
  864. + char *basename();
  865. diff -C2 -N patch-2.0.12u7/version.c patch-2.0.12u8/version.c
  866. *** patch-2.0.12u7/version.c    Sat Mar 14 14:44:29 1992
  867. --- patch-2.0.12u8/version.c    Wed Jul  8 19:17:26 1992
  868. ***************
  869. *** 14,17 ****
  870. --- 14,19 ----
  871.   #include "version.h"
  872.   
  873. + void my_exit();
  874.   /* Print out the version number and die. */
  875.   
  876. ***************
  877. *** 19,30 ****
  878.   version()
  879.   {
  880. !     void my_exit();
  881. !     extern char rcsid[];
  882. ! #ifdef lint
  883. !     rcsid[0] = rcsid[0];
  884. ! #else
  885. !     fprintf(stderr, "%s\nPatch level: %s\n", rcsid, PATCHLEVEL);
  886.       my_exit(0);
  887. - #endif
  888.   }
  889. --- 21,25 ----
  890.   version()
  891.   {
  892. !     fprintf(stderr, "Patch version 2.0, patch level %s\n", PATCHLEVEL);
  893.       my_exit(0);
  894.   }
  895.