HP-UX Reference (11i v2 03/08) - 1 User Commands N-Z (vol 2)

p
patch(1) patch(1)
Additionally, if the leading garbage contains a ‘‘Prereq: ’’ line, patch will take the first word from the
prerequisites line (normally a version number) and check the input file to see if that word can be found.
If not, patch will ask for confirmation before proceeding.
The upshot of all this is that you should be able to say, while in a news interface, the following:
| patch -d /usr/src/local/blurfl
and patch a file in the blurfl directory directly from the article containing the patch.
If the patch file contains more than one patch, patch will try to apply each of them as if they came from
separate patch files. This means, among other things, that it is assumed that the name of the file to patch
must be determined for each diff listing, and that the garbage before each diff listing will be examined for
interesting things such as filenames and revision level, as mentioned previously. You can give switches
(and another original file name) for the second and subsequent patches by separating the corresponding
argument lists by a ‘‘+’’. (The argument list for a second or subsequent patch may not specify a new patch
file, however.)
With XPG4 version, processing of multiple patches varies considerably. You can not specify different
options for different patches. Options remain same for all the patches. This also affects the contents of
output file specified with the -o option. See the description of this option for more details.
patch recognizes the following switches:
-b causes the next argument to be interpreted as the backup extension, to be used in place of ‘‘.orig’’.
(For XPG4 version this option varies. With this option no argument is required and the option only
enables the backup process. Always default extension is used.)
-c forces patch to interpret the patch file as a context diff.
-d causes patch to interpret the next argument as a directory, and cd to it before doing anything else.
-D causes patch to use the "#ifdef...#endif" construct to mark changes. The argument following will be
used as the differentiating symbol. Note that, unlike the C compiler, there must be a space between
the
-D and the argument. (For XPG4 version this option varies. With this version "#ifndef" con-
structor is not used.)
-e forces patch to interpret the patch file as an ed script.
-f forces patch to assume that the user knows exactly what he or she is doing, and to not ask any ques-
tions. It does not suppress commentary, however. Use -s for that. (This option is not supported
by XPG4 version.)
-F number
sets the maximum fuzz factor. This switch only applied to context diffs, and causes patch to ignore
up to that many lines in looking for places to install a hunk. Note that a larger fuzz factor increases
the odds of a faulty patch. The default fuzz factor is 2, and it may not be set to more than the
number of lines of context in the context diff, ordinarily 3. (This option is not supported by XPG4
version.)
-i This option is supported only by XPG4 version. It causes next argument to be interpreted as the
patch file name.
-l causes the pattern matching to be done loosely, in case the tabs and spaces have been munged in
your input file. Any sequence of whitespace in the pattern line will match any sequence in the input
file. Normal characters must still match exactly. Each line of the context must still match a line in
the input file.
-n forces patch to interpret the patch file as a normal diff.
-N causes patch to ignore patches that it thinks are reversed or already applied. See also -R.
-o causes the next argument to be interpreted as the output file name. There are some added features
for the XPG4 version. Multiple patches for a single file will be applied to the intermediate versions
of the file created by any previous patches, and will result in multiple,concatenated versions of the
file being written to output file.
-p number
sets the pathname strip count, which controls how pathnames found in the patch file are treated, in
case the you keep your files in a different directory than the person who sent out the patch. The
strip count specifies how many backslashes are to be stripped from the front of the pathname. (Any
intervening directory names also go away.) For example, supposing the filename in the patch file
HP-UX 11i Version 2: August 2003 2 Hewlett-Packard Company Section 1673