patch

QNX SDP8.0Utilities ReferenceUtilities

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

Syntax:

patch [-lRsu] [-d dir] [-i patch] [-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
Input patch file (default is stdin).
-i patch
Input patch 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).
file [patch]
The pathname of a file to apply as a unified diff.

Description:

The patch utility prints unified diffs (old and new text presented immediately adjacent) and only modifies a file when all hunks (sequences of lines that differ) to that file apply. The patch utility prints failed hunks to stderr and exits with nonzero status if any hunks fail.

A file compared against /dev/null (or with a date less than or equal to the Epoch (00:00 January 1, 1970)) is 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: