patch

QNX SDP8.0Utilities ReferenceUtilities

Apply a unified diff to one or more files (POSIX, toybox)

Syntax:

patch [-lRsuv] [-d dir] [-i file] [-p depth] [-F fuzz]
      [--dry-run] [file [patch]]

Runs on:

QNX OS

Options:

-d dir
Modify files in the specified directory.
--dry-run
Don't change files, just confirm if the patch applies.
-F fuzz
Fuzz factor; that is, the number of non-matching context lines allowed per hunk. The default is the number of leading or trailing context lines minus one (usually 2).
-i file
Input patch from the specified file (default is stdin).
-l
("el") Loose match (ignores whitespace).
-p depth
Number of forward slashes (/) to strip from start of filepaths (default all).
-R
Reverse patch.
-s
Be silent except for errors.
-u
Ignore (only handles "unified" diffs).
-v
Verbose. Specify -vv to see decisions.
file [patch]
The pathname of a file to apply as a unified diff.

Description:

The patch utility only handles diffs in unified format (unidiff). It only modifies a file when all hunks (sequences of lines that differ) to that file apply. It prints failed hunks to stderr and exits with nonzero status if any hunks fail.

Files compared against /dev/null (or with a date less than or equal to the Epoch (00:00 January 1, 1970)) are created or deleted as appropriate.

This utility is provided as part of the toybox package. For information on how to enable it, see toybox.

Contributing author:

Rob Landley and the toybox project (see https://landley.net/toybox/).

Page updated: