home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / unix / patch12.zoo / tcpatch2.dif < prev    next >
Encoding:
Text File  |  1990-08-07  |  23.8 KB  |  813 lines

  1. TurboC2.0 Patches to add TMP env var and better usage msg
  2. Prereq: 1
  3. *** ../tcpatch/tcpatlev.h    Wed Jul 18 10:37:44 1990
  4. --- tcpatlev.h    Wed Jul 18 10:38:10 1990
  5. ***************
  6. *** 1,1 ****
  7. ! #define TCPATCHLEVEL 1
  8. --- 1,1 ----
  9. ! #define TCPATCHLEVEL 2
  10. *** ../tcpatch/readme    Wed Jul 18 09:54:12 1990
  11. --- readme    Wed Jul 18 09:53:56 1990
  12. ***************
  13. *** 81,83 ****
  14. --- 81,92 ----
  15.   temp files go in directory /tmp
  16.   ed scripts disabled
  17.   
  18. + *** OFFICIAL PATCHLEVEL 12, TurboC2.0 PATCHLEVEL 2
  19. + From: ward@sneezy.cs.wisc.edu (Mike Ward)
  20. + Date: 31 May 90 
  21. + improved (more descriptive) usage message
  22. + temp files go in directory specified by TMP env var (or current dir if no TMP)
  23. + ed scripts still disabled
  24. *** ../tcpatch/common.h    Thu May 31 12:34:31 1990
  25. --- common.h    Thu May 31 12:47:03 1990
  26. **************
  27. *** 128,137
  28.   EXT char *origext INIT(Nullch);
  29.   EXT char *origprae INIT(Nullch);
  30.   
  31. ! EXT char TMPOUTNAME[] INIT("/tmp/patchoXXXXXX");
  32. ! EXT char TMPINNAME[] INIT("/tmp/patchiXXXXXX");    /* might want /usr/tmp here */
  33. ! EXT char TMPREJNAME[] INIT("/tmp/patchrXXXXXX");
  34. ! EXT char TMPPATNAME[] INIT("/tmp/patchpXXXXXX");
  35.   EXT bool toutkeep INIT(FALSE);
  36.   EXT bool trejkeep INIT(FALSE);
  37.   
  38. --- 128,137 -----
  39.   EXT char *origext INIT(Nullch);
  40.   EXT char *origprae INIT(Nullch);
  41.   
  42. ! EXT char *TMPOUTNAME INIT("/tmp/patchoXXXXXX");
  43. ! EXT char *TMPINNAME  INIT("/tmp/patchiXXXXXX");    /* might want /usr/tmp here */
  44. ! EXT char *TMPREJNAME INIT("/tmp/patchrXXXXXX");
  45. ! EXT char *TMPPATNAME INIT("/tmp/patchpXXXXXX");
  46.   EXT bool toutkeep INIT(FALSE);
  47.   EXT bool trejkeep INIT(FALSE);
  48.   
  49. *** ../tcpatch/tcpatch.c    Thu May 31 12:34:31 1990
  50. --- patch.c    Thu May 31 12:47:03 1990
  51. ***************
  52. *** 1,5 ****
  53.   char rcsid[] =
  54. !     "$Header: patch.c,v 2.0.1.6 88/06/22 20:46:39 lwall Locked $";
  55.   
  56.   /* patch - a program to apply diffs to original files
  57.    *
  58. --- 1,5 ----
  59.   char rcsid[] =
  60. !     "$Header: patch.c,v 2.0.1.7 90/05/30 11:30:00 mward $";
  61.   
  62.   /* patch - a program to apply diffs to original files
  63.    *
  64. ***************
  65. *** 9,14 ****
  66. --- 9,18 ----
  67.    * money off of it, or pretend that you wrote it.
  68.    *
  69.    * $Log:    patch.c,v $
  70. +  * Revision 2.0.1.7  90/05/30  11:30:00  mward
  71. +  * Added usage message vars and routines: use_msg, progname, usage, fname
  72. +  * Check environment for TMP and init temp file names
  73. +  * 
  74.    * Revision 2.0.1.6  88/06/22  20:46:39  lwall
  75.    * patch12: rindex() wasn't declared
  76.    * 
  77. ***************
  78. *** 97,102 ****
  79. --- 101,108 ----
  80.   
  81.   /* procedures */
  82.   
  83. + char *fname();
  84. + void usage();
  85.   void reinitialize_almost_everything();
  86.   void get_some_switches();
  87.   LINENUM locate_hunk();
  88. ***************
  89. *** 112,117 ****
  90. --- 118,195 ----
  91.   void re_input();
  92.   void my_exit();
  93.   
  94. + char *progname;
  95. + char *use_msg[] = {
  96. +     "purpose: apply diff file(s) to original(s) to generate updated file(s)\n",
  97. +     "usage:   %s [options] orig patchfile [+ [options] orig]\n",
  98. +     "         %s <patchfile\n"
  99. +     "options:\n",
  100. +     "   -         read patchfile from standard input\n",
  101. +     "   -?        display help message (this text)\n",
  102. +     "   -b arg    use arg as backup file extension (default is ~ or .orig)\n",
  103. +     "   -B arg    use arg as backup file prefix (cancels -b option)\n",
  104. +     "   -c        interpret patchfile as context diffs\n",
  105. +     "   -d arg    use arg as directory to cd to before continuing\n",
  106. +     "   -D arg    surround patched with \"#ifdef arg ... #endif\"\n",
  107. +     "   -e        interpret patchfile as an ed script\n",
  108. +     "   -f        do not ask questions\n",
  109. +     "   -F<num>   set max fuzz factor to <num> (default 2, context diffs only)\n",
  110. +     "   -h        display help message (this text)\n",
  111. +     "   -l        loose (non \\n whitespace) pattern matching\n",
  112. +     "   -n        interpret patchfile as a normal diff\n",
  113. +     "   -N        ignore patches that are reversed or already applied\n",
  114. +     "   -o arg    use arg as output file name\n",
  115. +     "   -p<num>   set path strip count to <num> (default 937,# /'s to strip)\n",
  116. +     "   -r arg    use arg as the reject file name\n",
  117. +     "   -R        interpret patch as if orig and new were reversed at diff gen\n",
  118. +     "   -s        silent operation - no messages\n",
  119. +     "   -S        skip current patch, but continue\n",
  120. +     "   -v        version - print revision header and patch level\n",
  121. +     "   -x<num>   set internal debugging flags to <num>\n",
  122. +     "examples\n",
  123. +     "   %s <ms_sh_16.dif         # normally read all patches from stdin\n",
  124. +     "   %s -S + -S + <patch.dif  # skip 1st and 3rd patches in patch.dif\n",
  125. +     "notes:\n"
  126. +     "   By default, the patched version is put in place of the original\n",
  127. +     NULL
  128. + };
  129. + /* Return pointer to first char of file name in spec */
  130. + char *
  131. + fname(char *spec)
  132. + {
  133. +     char *cptr;
  134. +     char *tptr;
  135. +     cptr = spec + strlen(spec);
  136. +     while ((cptr!=spec) && (index("/\\:",*(cptr-1))==Nullch)) {
  137. +         cptr--;
  138. +     }
  139. +     if ((tptr=index(cptr,'.'))!=Nullch) *tptr='\0';
  140. +     return (cptr);
  141. + }
  142. +
  143. + /* Print the usage message */
  144. + void
  145. + usage()
  146. + {
  147. +     char **ptr;
  148. +     char *name;
  149. +     name = fname(progname);
  150. +     for (ptr=use_msg; *ptr; ptr++) {
  151. +         say2(*ptr,name);
  152. +     }
  153. + }
  154.   /* Apply a set of diffs as appropriate. */
  155.   
  156.   main(argc,argv)
  157. ***************
  158. *** 126,135 ****
  159. --- 204,226 ----
  160.       int failed = 0;
  161.       int failtotal = 0;
  162.       int i;
  163. +     char tmpdir[MAXPATH];
  164. +     char *tmpenv;
  165.   
  166. +     progname = (*argv[0]?argv[0]:"patch");
  167.       setbuf(stderr, serrbuf);
  168.       for (i = 0; i<MAXFILEC; i++)
  169.       filearg[i] = Nullch;
  170. +     /* initialize temp file names */
  171. +     tmpenv = getenv("TMP");
  172. +     strcpy(tmpdir,(tmpenv!=NULL?tmpenv:""));
  173. +     if (strlen(tmpdir) && tmpdir[strlen(tmpdir)-1]!='/') strcat(tmpdir,"/");
  174. +     TMPOUTNAME = strcat(strcpy(malloc(MAXPATH),tmpdir),fname(TMPOUTNAME));
  175. +     TMPINNAME  = strcat(strcpy(malloc(MAXPATH),tmpdir),fname(TMPINNAME));
  176. +     TMPREJNAME = strcat(strcpy(malloc(MAXPATH),tmpdir),fname(TMPREJNAME));
  177. +     TMPPATNAME = strcat(strcpy(malloc(MAXPATH),tmpdir),fname(TMPPATNAME));
  178.       Mktemp(TMPOUTNAME);
  179.       Mktemp(TMPINNAME);
  180.       Mktemp(TMPREJNAME);
  181. ***************
  182. *** 426,431 ****
  183. --- 517,527 ----
  184.               s++;
  185.           maxfuzz = atoi(s);
  186.           break;
  187. +         case '?':
  188. +         case 'h':
  189. +         usage();
  190. +         my_exit(0);
  191. +         break;
  192.           case 'l':
  193.           canonicalize = TRUE;
  194.           break;
  195. ***************
  196. *** 466,472 ****
  197.           break;
  198.   #endif
  199.           default:
  200. !         fatal2("Unrecognized switch: %s\n", Argv[0]);
  201.           }
  202.       }
  203.       }
  204. --- 562,570 ----
  205.           break;
  206.   #endif
  207.           default:
  208. !         say2("Unrecognized switch: %s\n", Argv[0]);
  209. !         usage();
  210. !         my_exit(1);
  211.           }
  212.       }
  213.       }
  214. *** ../patch/patch.man    Wed May 30 15:02:54 1990
  215. --- patch.man    Sat Jun 02 07:31:00 1990
  216. ***************
  217. *** 1,72 ****
  218. ! .rn '' }`
  219. ! ''' $Header: patch.man,v 2.0.1.2 88/06/22 20:47:18 lwall Locked $
  220. ! ''' 
  221. ! ''' $Log:    patch.man,v $
  222. ! ''' Revision 2.0.1.2  88/06/22  20:47:18  lwall
  223. ! ''' patch12: now avoids Bell System Logo
  224. ! ''' 
  225. ! ''' Revision 2.0.1.1  88/06/03  15:12:51  lwall
  226. ! ''' patch10: -B switch was contributed.
  227. ! ''' 
  228. ! ''' Revision 2.0  86/09/17  15:39:09  lwall
  229. ! ''' Baseline for netwide release.
  230. ! ''' 
  231. ! ''' Revision 1.4  86/08/01  19:23:22  lwall
  232. ! ''' Documented -v, -p, -F.
  233. ! ''' Added notes to patch senders.
  234. ! ''' 
  235. ! ''' Revision 1.3  85/03/26  15:11:06  lwall
  236. ! ''' Frozen.
  237. ! ''' 
  238. ! ''' Revision 1.2.1.4  85/03/12  16:14:27  lwall
  239. ! ''' Documented -p.
  240. ! ''' 
  241. ! ''' Revision 1.2.1.3  85/03/12  16:09:41  lwall
  242. ! ''' Documented -D.
  243. ! ''' 
  244. ! ''' Revision 1.2.1.2  84/12/05  11:06:55  lwall
  245. ! ''' Added -l switch, and noted bistability bug.
  246. ! ''' 
  247. ! ''' Revision 1.2.1.1  84/12/04  17:23:39  lwall
  248. ! ''' Branch for sdcrdcf changes.
  249. ! ''' 
  250. ! ''' Revision 1.2  84/12/04  17:22:02  lwall
  251. ! ''' Baseline version.
  252. ! ''' 
  253. ! .de Sh
  254. ! .br
  255. ! .ne 5
  256. ! .PP
  257. ! \fB\\$1\fR
  258. ! .PP
  259. ! ..
  260. ! .de Sp
  261. ! .if t .sp .5v
  262. ! .if n .sp
  263. ! ..
  264. ! '''
  265. ! '''     Set up \*(-- to give an unbreakable dash;
  266. ! '''     string Tr holds user defined translation string.
  267. ! '''     Bell System Logo is used as a dummy character.
  268. ! '''
  269. ! .ie n \{\
  270. ! .tr \(*W-\*(Tr
  271. ! .ds -- \(*W-
  272. ! .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  273. ! .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  274. ! .ds L" ""
  275. ! .ds R" ""
  276. ! .ds L' '
  277. ! .ds R' '
  278. ! 'br\}
  279. ! .el\{\
  280. ! .ds -- \(em\|
  281. ! .tr \*(Tr
  282. ! .ds L" ``
  283. ! .ds R" ''
  284. ! .ds L' `
  285. ! .ds R' '
  286. ! 'br\}
  287.   .TH PATCH 1 LOCAL
  288.   .SH NAME
  289.   patch - a program for applying a diff file to an original
  290. --- 1,5 ----
  291. ! .sc ^
  292. ! .nj
  293.   .TH PATCH 1 LOCAL
  294.   .SH NAME
  295.   patch - a program for applying a diff file to an original
  296. ***************
  297. *** 87,93 ****
  298.   version.
  299.   By default, the patched version is put in place of the original, with
  300.   the original file backed up to the same name with the
  301. ! extension \*(L".orig\*(R" or \*(L"~\*(R" , or as specified by the
  302.   .B -b
  303.   switch.
  304.   You may also specify where you want the output to go with a
  305. --- 20,26 ----
  306.   version.
  307.   By default, the patched version is put in place of the original, with
  308.   the original file backed up to the same name with the
  309. ! extension ".orig" or "~", or as specified by the
  310.   .B -b
  311.   switch.
  312.   You may also specify where you want the output to go with a
  313. ***************
  314. *** 99,107 ****
  315.   .PP
  316.   Upon startup, patch will attempt to determine the type of the diff listing,
  317.   unless over-ruled by a
  318. ! .BR -c ,
  319. ! .BR -e ,
  320. ! or
  321.   .B -n
  322.   switch.
  323.   Context diffs and normal diffs are applied by the
  324. --- 32,41 ----
  325.   .PP
  326.   Upon startup, patch will attempt to determine the type of the diff listing,
  327.   unless over-ruled by a
  328. ! .B -c
  329. ! ,
  330. ! .B -e
  331. ! , or
  332.   .B -n
  333.   switch.
  334.   Context diffs and normal diffs are applied by the
  335. ***************
  336. *** 144,150 ****
  337.   .I patch
  338.   cannot find a place to install that hunk of the patch, it will put the
  339.   hunk out to a reject file, which normally is the name of the output file
  340. ! plus \*(L".rej\*(R" or \*(L"#\*(R" .
  341.   (Note that the rejected hunk will come out in context diff form whether the
  342.   input patch was a context diff or a normal diff.
  343.   If the input was a normal diff, many of the contexts will simply be null.)
  344. --- 78,84 ----
  345.   .I patch
  346.   cannot find a place to install that hunk of the patch, it will put the
  347.   hunk out to a reject file, which normally is the name of the output file
  348. ! plus ".rej" or "#" .
  349.   (Note that the rejected hunk will come out in context diff form whether the
  350.   input patch was a context diff or a normal diff.
  351.   If the input was a normal diff, many of the contexts will simply be null.)
  352. ***************
  353. *** 168,176 ****
  354.   will try to figure out from the leading garbage what the name of the file
  355.   to edit is.
  356.   In the header of a context diff, the filename is found from lines beginning
  357. ! with \*(L"***\*(R" or \*(L"---\*(R", with the shortest name of an existing
  358.   file winning.
  359. ! Only context diffs have lines like that, but if there is an \*(L"Index:\*(R"
  360.   line in the leading garbage,
  361.   .I patch
  362.   will try to use the filename from that line.
  363. --- 102,110 ----
  364.   will try to figure out from the leading garbage what the name of the file
  365.   to edit is.
  366.   In the header of a context diff, the filename is found from lines beginning
  367. ! with "***" or "---", with the shortest name of an existing
  368.   file winning.
  369. ! Only context diffs have lines like that, but if there is an "Index:"
  370.   line in the leading garbage,
  371.   .I patch
  372.   will try to use the filename from that line.
  373. ***************
  374. *** 183,189 ****
  375.   .I patch
  376.   will attempt to get or check out the file.)
  377.   .PP
  378. ! Additionally, if the leading garbage contains a \*(L"Prereq: \*(R" line,
  379.   .I patch
  380.   will take the first word from the prerequisites line (normally a version
  381.   number) and check the input file to see if that word can be found.
  382. --- 117,123 ----
  383.   .I patch
  384.   will attempt to get or check out the file.)
  385.   .PP
  386. ! Additionally, if the leading garbage contains a "Prereq: " line,
  387.   .I patch
  388.   will take the first word from the prerequisites line (normally a version
  389.   number) and check the input file to see if that word can be found.
  390. ***************
  391. *** 215,257 ****
  392.   .PP
  393.   .I Patch
  394.   recognizes the following switches:
  395. ! .TP 5
  396. ! .B \-b
  397.   causes the next argument to be interpreted as the backup extension, to be
  398. ! used in place of \*(L".orig\*(R" or \*(L"~\*(R".
  399. ! .TP 5
  400. ! .B \-B
  401.   causes the next argument to be interpreted as a prefix to the backup file
  402.   name. If this argument is specified any argument from -b will be ignored.
  403.   This argument is an extension to Larry Wall's patch v2.0.1.4, patchlevel 8,
  404.   made by M. Greim (greim@sbsvax.uucp).
  405. ! .TP 5
  406. ! .B \-c
  407.   forces
  408.   .I patch
  409.   to interpret the patch file as a context diff.
  410. ! .TP 5
  411. ! .B \-d
  412.   causes
  413.   .I patch
  414.   to interpret the next argument as a directory, and cd to it before doing
  415.   anything else.
  416. ! .TP 5
  417. ! .B \-D
  418.   causes
  419.   .I patch
  420.   to use the "#ifdef...#endif" construct to mark changes.
  421.   The argument following will be used as the differentiating symbol.
  422.   Note that, unlike the C compiler, there must be a space between the
  423. ! .B \-D
  424.   and the argument.
  425. ! .TP 5
  426. ! .B \-e
  427.   forces
  428.   .I patch
  429.   to interpret the patch file as an ed script.
  430. ! .TP 5
  431. ! .B \-f
  432.   forces
  433.   .I patch
  434.   to assume that the user knows exactly what he or she is doing, and to not
  435. --- 149,185 ----
  436.   .PP
  437.   .I Patch
  438.   recognizes the following switches:
  439. ! .IN 8
  440. ! .TP -b
  441.   causes the next argument to be interpreted as the backup extension, to be
  442. ! used in place of ".orig" or "~".
  443. ! .TP -B
  444.   causes the next argument to be interpreted as a prefix to the backup file
  445.   name. If this argument is specified any argument from -b will be ignored.
  446.   This argument is an extension to Larry Wall's patch v2.0.1.4, patchlevel 8,
  447.   made by M. Greim (greim@sbsvax.uucp).
  448. ! .TP -c
  449.   forces
  450.   .I patch
  451.   to interpret the patch file as a context diff.
  452. ! .TP -d
  453.   causes
  454.   .I patch
  455.   to interpret the next argument as a directory, and cd to it before doing
  456.   anything else.
  457. ! .TP -D
  458.   causes
  459.   .I patch
  460.   to use the "#ifdef...#endif" construct to mark changes.
  461.   The argument following will be used as the differentiating symbol.
  462.   Note that, unlike the C compiler, there must be a space between the
  463. ! .B -D
  464.   and the argument.
  465. ! .TP -e
  466.   forces
  467.   .I patch
  468.   to interpret the patch file as an ed script.
  469. ! .TP -f
  470.   forces
  471.   .I patch
  472.   to assume that the user knows exactly what he or she is doing, and to not
  473. ***************
  474. *** 258,267 ****
  475.   ask any questions.
  476.   It does not suppress commentary, however.
  477.   Use
  478. ! .B \-s
  479.   for that.
  480. ! .TP 5
  481. ! .B \-F<number>
  482.   sets the maximum fuzz factor.
  483.   This switch only applies to context diffs, and causes
  484.   .I patch
  485. --- 186,194 ----
  486.   ask any questions.
  487.   It does not suppress commentary, however.
  488.   Use
  489. ! .B -s
  490.   for that.
  491. ! .TP -F<number>
  492.   sets the maximum fuzz factor.
  493.   This switch only applies to context diffs, and causes
  494.   .I patch
  495. ***************
  496. *** 269,276 ****
  497.   Note that a larger fuzz factor increases the odds of a faulty patch.
  498.   The default fuzz factor is 2, and it may not be set to more than
  499.   the number of lines of context in the context diff, ordinarily 3.
  500. ! .TP 5
  501. ! .B \-l
  502.   causes the pattern matching to be done loosely, in case the tabs and
  503.   spaces have been munged in your input file.
  504.   Any sequence of whitespace in the pattern line will match any sequence
  505. --- 196,202 ----
  506.   Note that a larger fuzz factor increases the odds of a faulty patch.
  507.   The default fuzz factor is 2, and it may not be set to more than
  508.   the number of lines of context in the context diff, ordinarily 3.
  509. ! .TP -l
  510.   causes the pattern matching to be done loosely, in case the tabs and
  511.   spaces have been munged in your input file.
  512.   Any sequence of whitespace in the pattern line will match any sequence
  513. ***************
  514. *** 277,299 ****
  515.   in the input file.
  516.   Normal characters must still match exactly.
  517.   Each line of the context must still match a line in the input file.
  518. ! .TP 5
  519. ! .B \-n
  520.   forces
  521.   .I patch
  522.   to interpret the patch file as a normal diff.
  523. ! .TP 5
  524. ! .B \-N
  525.   causes
  526.   .I patch
  527.   to ignore patches that it thinks are reversed or already applied.
  528.   See also
  529. ! .B \-R .
  530. ! .TP 5
  531. ! .B \-o
  532.   causes the next argument to be interpreted as the output file name.
  533. ! .TP 5
  534. ! .B \-p<number>
  535.   sets the pathname strip count,
  536.   which controls how pathnames found in the patch file are treated, in case
  537.   the you keep your files in a different directory than the person who sent
  538. --- 203,221 ----
  539.   in the input file.
  540.   Normal characters must still match exactly.
  541.   Each line of the context must still match a line in the input file.
  542. ! .TP -n
  543.   forces
  544.   .I patch
  545.   to interpret the patch file as a normal diff.
  546. ! .TP -N
  547.   causes
  548.   .I patch
  549.   to ignore patches that it thinks are reversed or already applied.
  550.   See also
  551. ! .B -R .
  552. ! .TP -o
  553.   causes the next argument to be interpreted as the output file name.
  554. ! .TP -p<number>
  555.   sets the pathname strip count,
  556.   which controls how pathnames found in the patch file are treated, in case
  557.   the you keep your files in a different directory than the person who sent
  558. ***************
  559. *** 306,338 ****
  560.       /u/howard/src/blurfl/blurfl.c
  561.   .sp
  562.   setting
  563. ! .B \-p
  564.   or
  565. ! .B \-p0
  566.   gives the entire pathname unmodified,
  567. ! .B \-p1
  568.   gives
  569.   .sp
  570.       u/howard/src/blurfl/blurfl.c
  571.   .sp
  572.   without the leading slash,
  573. ! .B \-p4
  574.   gives
  575.   .sp
  576.       blurfl/blurfl.c
  577.   .sp
  578.   and not specifying
  579. ! .B \-p
  580.   at all just gives you "blurfl.c".
  581.   Whatever you end up with is looked for either in the current directory,
  582.   or the directory specified by the
  583. ! .B \-d
  584.   switch.
  585. ! .TP 5
  586. ! .B \-r
  587.   causes the next argument to be interpreted as the reject file name.
  588. ! .TP 5
  589. ! .B \-R
  590.   tells
  591.   .I patch
  592.   that this patch was created with the old and new files swapped.
  593. --- 228,258 ----
  594.       /u/howard/src/blurfl/blurfl.c
  595.   .sp
  596.   setting
  597. ! .B -p
  598.   or
  599. ! .B -p0
  600.   gives the entire pathname unmodified,
  601. ! .B -p1
  602.   gives
  603.   .sp
  604.       u/howard/src/blurfl/blurfl.c
  605.   .sp
  606.   without the leading slash,
  607. ! .B -p4
  608.   gives
  609.   .sp
  610.       blurfl/blurfl.c
  611.   .sp
  612.   and not specifying
  613. ! .B -p
  614.   at all just gives you "blurfl.c".
  615.   Whatever you end up with is looked for either in the current directory,
  616.   or the directory specified by the
  617. ! .B -d
  618.   switch.
  619. ! .TP -r
  620.   causes the next argument to be interpreted as the reject file name.
  621. ! .TP -R
  622.   tells
  623.   .I patch
  624.   that this patch was created with the old and new files swapped.
  625. ***************
  626. *** 342,348 ****
  627.   will attempt to swap each hunk around before applying it.
  628.   Rejects will come out in the swapped format.
  629.   The
  630. ! .B \-R
  631.   switch will not work with ed diff scripts because there is too little
  632.   information to reconstruct the reverse operation.
  633.   .Sp
  634. --- 262,268 ----
  635.   will attempt to swap each hunk around before applying it.
  636.   Rejects will come out in the swapped format.
  637.   The
  638. ! .B -R
  639.   switch will not work with ed diff scripts because there is too little
  640.   information to reconstruct the reverse operation.
  641.   .Sp
  642. ***************
  643. *** 350,356 ****
  644.   .I patch
  645.   will reverse the hunk to see if it can be applied that way.
  646.   If it can, you will be asked if you want to have the
  647. ! .B \-R
  648.   switch set.
  649.   If it can't, the patch will continue to be applied normally.
  650.   (Note: this method cannot detect a reversed patch if it is a normal diff
  651. --- 270,276 ----
  652.   .I patch
  653.   will reverse the hunk to see if it can be applied that way.
  654.   If it can, you will be asked if you want to have the
  655. ! .B -R
  656.   switch set.
  657.   If it can't, the patch will continue to be applied normally.
  658.   (Note: this method cannot detect a reversed patch if it is a normal diff
  659. ***************
  660. *** 360,372 ****
  661.   Luckily, most patches add or change lines rather than delete them, so most
  662.   reversed normal diffs will begin with a delete, which will fail, triggering
  663.   the heuristic.)
  664. ! .TP 5
  665. ! .B \-s
  666.   makes
  667.   .I patch
  668.   do its work silently, unless an error occurs.
  669. ! .TP 5
  670. ! .B \-S
  671.   causes
  672.   .I patch
  673.   to ignore this patch from the patch file, but continue on looking
  674. --- 280,290 ----
  675.   Luckily, most patches add or change lines rather than delete them, so most
  676.   reversed normal diffs will begin with a delete, which will fail, triggering
  677.   the heuristic.)
  678. ! .TP -s
  679.   makes
  680.   .I patch
  681.   do its work silently, unless an error occurs.
  682. ! .TP -S
  683.   causes
  684.   .I patch
  685.   to ignore this patch from the patch file, but continue on looking
  686. ***************
  687. *** 376,396 ****
  688.       patch -S + -S + <patchfile
  689.   .sp
  690.   will ignore the first and second of three patches.
  691. ! .TP 5
  692. ! .B \-v
  693.   causes
  694.   .I patch
  695.   to print out it's revision header and patch level.
  696. ! .TP 5
  697. ! .B \-x<number>
  698.   sets internal debugging flags, and is of interest only to
  699.   .I patch
  700.   patchers.
  701.   .SH AUTHOR
  702.   Larry Wall <lwall@jpl-devvax.jpl.nasa.gov>
  703.   .SH ENVIRONMENT
  704. ! No environment variables are used by
  705. ! .IR patch .
  706.   .SH FILES
  707.   /tmp/patch*
  708.   .SH SEE ALSO
  709. --- 294,319 ----
  710.       patch -S + -S + <patchfile
  711.   .sp
  712.   will ignore the first and second of three patches.
  713. ! .TP -v
  714.   causes
  715.   .I patch
  716.   to print out it's revision header and patch level.
  717. ! .TP -x<number>
  718.   sets internal debugging flags, and is of interest only to
  719.   .I patch
  720.   patchers.
  721. + .OD
  722.   .SH AUTHOR
  723.   Larry Wall <lwall@jpl-devvax.jpl.nasa.gov>
  724.   .SH ENVIRONMENT
  725. ! .IN 8
  726. ! .TP TMP
  727. ! The location for temporary files created by
  728. ! .I patch.
  729. ! This string specifies the directory where
  730. ! .I patch
  731. ! puts any tempoorary files, and can (but need not) contain a terminating slash.
  732. ! .OD
  733.   .SH FILES
  734.   /tmp/patch*
  735.   .SH SEE ALSO
  736. ***************
  737. *** 407,413 ****
  738.   context diff header, or with an Index: line.
  739.   If you are patching something in a subdirectory, be sure to tell the patch
  740.   user to specify a 
  741. ! .B \-p
  742.   switch as needed.
  743.   Third, you can create a file by sending out a diff that compares a
  744.   null file to the file you want to create.
  745. --- 330,336 ----
  746.   context diff header, or with an Index: line.
  747.   If you are patching something in a subdirectory, be sure to tell the patch
  748.   user to specify a 
  749. ! .B -p
  750.   switch as needed.
  751.   Third, you can create a file by sending out a diff that compares a
  752.   null file to the file you want to create.
  753. ***************
  754. *** 423,429 ****
  755.   .I patch
  756.   couldn't parse your patch file.
  757.   .PP
  758. ! The message \*(L"Hmm...\*(R" indicates that there is unprocessed text in
  759.   the patch file and that
  760.   .I patch
  761.   is attempting to intuit whether there is a patch in that text and, if so,
  762. --- 346,352 ----
  763.   .I patch
  764.   couldn't parse your patch file.
  765.   .PP
  766. ! The message "Hmm..." indicates that there is unprocessed text in
  767.   the patch file and that
  768.   .I patch
  769.   is attempting to intuit whether there is a patch in that text and, if so,
  770. ***************
  771. *** 436,443 ****
  772.   .SH CAVEATS
  773.   .I Patch
  774.   cannot tell if the line numbers are off in an ed script, and can only detect
  775. ! bad line numbers in a normal diff when it finds a \*(L"change\*(R" or
  776. ! a \*(L"delete\*(R" command.
  777.   A context diff using fuzz factor 3 may have the same problem.
  778.   Until a suitable interactive interface is added, you should probably do
  779.   a context diff in these cases to see if the changes made sense.
  780. --- 359,366 ----
  781.   .SH CAVEATS
  782.   .I Patch
  783.   cannot tell if the line numbers are off in an ed script, and can only detect
  784. ! bad line numbers in a normal diff when it finds a "change" or
  785. ! a "delete" command.
  786.   A context diff using fuzz factor 3 may have the same problem.
  787.   Until a suitable interactive interface is added, you should probably do
  788.   a context diff in these cases to see if the changes made sense.
  789. ***************
  790. *** 464,467 ****
  791.   .I patch
  792.   will think it is a reversed patch, and offer to un-apply the patch.
  793.   This could be construed as a feature.
  794. - .rn }` ''
  795. --- 387,389 ----
  796.