patch.1 (2010 09)
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 file names and revision level, as mentioned previously. You can give options
(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 the UNIX Standard (see standards (5)) 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.
Options
patch recognizes the following options:
-b causes the next argument to be interpreted as the backup extension, to be used in place of
.orig.
(For the UNIX Standard (see standards (5)) version, this option varies. With this option, no argu-
ment is required and the option only enables the backup process. The default extension is always
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 the UNIX Standard (see standards (5)) version, this option
varies. With this version, the
#ifndef constructor 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
questions. It does not suppress commentary, however. Use -s for that. This option is not sup-
ported by the UNIX Standard version.
-F number
sets the maximum fuzz factor. This option 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 the UNIX
Standard version.
-i This option is supported only by the UNIX Standard version. See standards (5)) for information
about the UNIX standard environment. 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 white space 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 UNIX Standard version. For information about the UNIX standard environment, see stan-
dards(5). 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.
2 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: September 2010