patch

Use the output from diff et al. to update a file (GNU)

Syntax:

patch [option]... [origfile [patchfile]]

Runs on:

QNX Neutrino

Options:

Input options:

-p num
--strip= num
Strip num leading components from file names.
-F lines
--fuzz lines
Set the fuzz factor to lines for inexact matching.
-l
--ignore-whitespace
Ignore white space changes between the patch and the input.
-c
--context
Interpret the patch as a context difference.
-e
--ed
Interpret the patch as an ed script.
-n
--normal
Interpret the patch as a normal difference.
-u
--unified
Interpret the patch as a unified difference.
-N
--forward
Ignore patches that appear to be reversed or already applied.
-R
--reverse
Assume patches were created with old and new files swapped.
-i patchfile
--input=patchfile
Read the patch from patchfile instead of stdin.

Output options:

-o file
--output=file
Output the patched files to file.
-r file
--reject-file=file
Output rejects to file.
-D name
--ifdef=name
Make merged if-then-else output using name.
-E
--remove-empty-files
Remove output files that are empty after patching.
-Z
--set-utc
Set the times of patched files, assuming diff uses UTC (GMT).
-T
--set-time
Likewise, assuming local time.
--quoting-style=word
Output file names using quoting style word. The values for word are: literal, shell, shell-always, c, and escape. The default is taken from the QUOTING_STYLE environment variable; if this variable isn't set, patch uses shell.

Backup and version control options:

-b
--backup
Back up the original contents of each file.
--backup-if-mismatch
Back up if the patch doesn't match exactly.
--no-backup-if-mismatch
Back up mismatches only if otherwise requested.
-V style
--version-control=style
Use style version control, where style is simple, numbered, or existing.
-B prefix
--prefix=prefix
Prepend prefix to the names of backup files.
-Y prefix
--basename-prefix=prefix
Prepend prefix to the base names of backup files.
-z suffix
--suffix=suffix
Append suffix to the names of backup files.
-g num
--get=num
Get files from RCS etc., if num is positive; ask if it's negative.

Miscellaneous options:

-t
--batch
Ask no questions; skip bad-Prereq patches; assume reversed.
-f
--force
Like -t, but ignore bad-Prereq patches, and assume unreversed.
-s
--quiet
--silent
Work silently unless an error occurs.
--verbose
Output extra information about the work being done.
--dry-run
Don't actually change any files; just print what would happen.
--posix
Conform to the POSIX standard.
-d dir
--directory=dir
Change the working directory to dir first.
--binary
Read and write data in binary mode (no effect on this platform).
-v
--version
Output version info.
--help
Display some help.

Description:

The patch utility use the output from diff, diff3, and cmp to update a file.

Environment variables:

QUOTING_STYLE
The default quoting style. The possible values are: literal, shell, shell-always, c, and escape. If QUOTING_STYLE isn't set, patch uses shell. You can override this variable by using the --quoting-style option.

Contributing author:

GNU

See also:

cmp, diff, diff3