Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

patch(1) OSS Shell and Utilities Reference Manual
If number is omitted or 0, then the pathname is not modied. If the -p ag is
omitted, all slashes and directory names preceding the lename are stripped.
For example, if the lename in the patch le was /u/howard/src/blur/blur.c,
entering -p or -p0 leaves the entire pathname unmodied. Entering -p1 results in
u/howard/src/blur/blur.c without the leading slash. Entering -p4 results in
blur/blur.c. Omitting -p from the patch command line results in blur.c.
The patch command looks for the resulting pathname in either the current direc-
tory or the directory specied by the -d ag.
-r rejectfile Species the lename of the reject le. By default, the reject le has the same
name as the output le, with the sufx .rej appended.
-R Reverses the sense of the patch script; that is, patch assumes that the diff script
was created by comparing the new version to the old version. The patch com-
mand tries to reverse each portion of the script before applying it. Rejected
differences are saved in swapped format.
If this ag is not specied, then until a portion of the patch le is successfully
applied, patch tries to apply each portion in its reversed sense as well as in its
normal sense. If the attempt is successful, you are prompted to determine
whether -R should be set.
Note that this method cannot detect a reversed patch if it is a normal diff script
and if the rst command is an append (that is, it should have been a delete):
appends always succeed because a NULL context matches anywhere. However,
most patches add or change lines rather than delete them, so most reversed nor-
mal diff scripts begin with a delete, which will fail, triggering the heuristic.
-s Patches silently unless an error occurs.
-S Ignores a patch from the patch le, but continues looking for the next patch in
the le. For example
patch -S + -S + <patchle
ignores the rst and second patches in patchle.
-v Prints out the revision header and patch level.
+ flags [original_file]
Species ags (and possibly another original lename) for the second and subse-
quent patches. The argument list for each patch must be preceded with + (plus
sign). (Note that the argument list for a second or subsequent patch may not
specify a new patch le.)
Operands
original_file Species the le to be patched.
DESCRIPTION
The patch command takes a patch le that contains either of the forms of difference listing pro-
duced by the diff program (normal or context) and applies those differences to an original le,
producing a patched version.
By default, the patched version of a le replaces the original. The original le can be backed up
to the same name with the extension .orig by specifying the -b ag. You can also specify where
you want the output to go with the -o ag. If the -i patchle ag is not specied, or if patchle is
- (dash), the patch is read from the standard input le.
78 Hewlett-Packard Company 527188-004