MPE/iX Shell and Utilities Reference Manual, Vol 2

patch(1) MPE/iX Shell and Utilities patch(1)
If patch still cannot find a match, it writes the unmatching portion to the reject file.It
then tries to process the next section of changes. Thus the reject file contains the sections
that patch is not able to change. Line numbers on sections in the reject file may be dif-
ferent than those in the patchfile, since patch adjusts them using the adjustment that
patch calculated for preceding sections.
To some extent, patch tries the same process if the patchfile is in normal rather than context
format. Because the patchfile does not contain the context information, patch has less to
work with and probably creates more rejects. patch always writes the reject file in context
format, regardless of the format of the patchfile.
By default, the reject file has the same name as the original file, plus the suffix .rej. You can
use –r to specify a different reject file on the command line. If the reject file already exists,
patch does not try to overwrite it; it simply terminates with a status greater than 1.
If you do not specify –R, patch starts out with the assumption that the patchfile could be
normal or reversed. Therefore if the first change is rejected, patch tries the reverse change
to see if that one works. If the reverse change is also rejected, patch continues on with other
changes in the file, trying both forward changes and reverses until one of them works. If the
one that works is a forward change, patch only attempts forward changes for the rest of the
file. If the one that works is a reverse change, patch issues a message to this effect and asks
if it should treat all changes as reverse ones.
The patchfile can contain output from several diff comparisons. patch treats each collec-
tion of changes as a separate patchfile, and with each, patch may prompt you for the name of
the file to be patched.
Options
patch accepts the following options:
–B prefix
saves a copy of the original file in a file with the same name preceded by the string
prefix. If there is already a file with this name, patch does not touch it and termi-
nates with a status greater than 1.
–b saves a copy of the original file in a file with the same name plus the suffix .orig.
If there is already a file with this name, patch overwrites it. When applying more
than one patch to the same file, patch only creates file.orig for the first patch.
When you also specify –o outfile, patch does not create file.orig, but if outfile
already exists, it creates outfile.orig.
–c interprets the patchfile as a context diff file (the output of diff when –c or –C is
specified). You cannot use this option with –e or –n.
Commands and Utilities 1-409