Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
User Commands (p - r) patch(1)
NAME
patch - Applies changes to files
SYNOPSIS
patch
[-bflNRsSv ]
[-c | -n ]
[-B prefix ]
[-d directory ]
[-D define ]
[-i patchfile ]
[-o outfile ]
[-p [number ]]
[-r rejectfile ]
[original_file ]
[[+ flags ][original_file ]...]
FLAGS
-b Saves a copy of the original contents of each modified file, before the differences
are applied, in a file of the same name with the suffix .orig appended. If the file
already exists, it is overwritten; if multiple patches are applied to the same file,
the .orig file is written only for the first patch. If -o outfile is also specified,
patchfile.orig is not created, but if outfile already exists, outfile.orig is created.
-B prefix Specifies a prefix to the backup filename.
-c Interprets the patch file as a context diff script (the output of diff when the -c or
-C flag is specified).
-d directory Changes the current directory to directory before processing.
-D define Uses the C preprocessor #ifdef define #endif construct to mark changes. The
define argument is used as the differentiating symbol.
-f Suppresses queries to the user. To suppress commentary, use the -s flag.
-i patchfile Reads the patch information from the file named by patchfile, rather than from
the standard input file.
-l Causes any sequence of spaces and tabs (white space) in the diff script to match
any sequence of spaces in the input file. Other characters are matched exactly.
-n Interprets the script as a normal diff script.
-N Ignores patches where the differences have already been applied to the file; by
default, already applied patches are rejected. (See the -R flag.)
-o outfile Instead of modifying the files (specified by the patchfile argument or the diff list-
ings) directly, writes a copy of the file referenced by each patch, with the
appropriate differences applied, to outfile. Multiple patches for a single file are
applied to the intermediate versions of the file created by any previous patches,
and result in multiple, concatenated versions of the file written to outfile.
-p [number ] Sets the pathname strip count, which controls how pathnames found in the patch
file are treated. This flag is useful if you keep your files in a different directory
than that specified by the patch. The strip count number specifies how many
slashes to strip from the front of a pathname. Any intervening directory names
are also stripped.
527188-004 Hewlett-Packard Company 7−7