summaryrefslogtreecommitdiff
path: root/usr.bin/patch/patch.1
diff options
context:
space:
mode:
authorwiz <wiz@NetBSD.org>2023-06-16 11:27:00 +0000
committerwiz <wiz@NetBSD.org>2023-06-16 11:27:00 +0000
commitebbaadf3bfe5024fbac96030b6963f0b83ffdc7f (patch)
tree75268c9ce7758672f2c58d0c9c13d1cf70f155de /usr.bin/patch/patch.1
parent9ba431d1b3de58f5f9fbd4fd10055833c816c757 (diff)
patch: add --backup-if-mismatch and --no-backup-if-mismatch for GNU patch compatibility
These options only make sense in POSIX mode, since NetBSD's patch has --backup enabled by default and GNU patch doesn't. In POSIX mode, GNU patch and NetBSD patch now behave the same for these two options.
Diffstat (limited to 'usr.bin/patch/patch.1')
-rw-r--r--usr.bin/patch/patch.123
1 files changed, 18 insertions, 5 deletions
diff --git a/usr.bin/patch/patch.1 b/usr.bin/patch/patch.1
index 1f434c7c83b..2c6217abc78 100644
--- a/usr.bin/patch/patch.1
+++ b/usr.bin/patch/patch.1
@@ -1,6 +1,6 @@
.\" $OpenBSD: patch.1,v 1.22 2008/06/06 20:44:00 jmc Exp $
.\" $DragonFly: src/usr.bin/patch/patch.1,v 1.10 2008/08/18 19:15:55 joerg Exp $
-.\" $NetBSD: patch.1,v 1.21 2017/07/03 21:34:20 wiz Exp $
+.\" $NetBSD: patch.1,v 1.22 2023/06/16 11:27:00 wiz Exp $
.\" Copyright 1986, Larry Wall
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -21,7 +21,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd November 7, 2015
+.Dd June 16, 2023
.Dt PATCH 1
.Os
.Sh NAME
@@ -41,6 +41,8 @@
.Op Fl V Cm t | nil | never | none
.Op Fl x Ar number
.Op Fl z Ar backup-ext
+.Op Fl Fl backup-if-mismatch
+.Op Fl Fl no-backup-if-mismatch
.Op Fl Fl posix
.Op Ar origfile Op Ar patchfile
.Nm
@@ -100,8 +102,15 @@ backup is made.
This is equivalent to specifying
.Qo Fl V Cm existing Qc .
This option is currently the default, unless
-.Fl -posix
+.Fl Fl posix
is specified.
+.It Fl Fl backup-if-mismatch
+Create a backup file if the patch doesn't apply cleanly.
+This option only makes sense when
+.Fl Fl backup
+is disabled, i.e. when in
+.Fl Fl posix
+mode.
.It Fl C , Fl Fl check
Checks that the patch would apply cleanly, but does not modify anything.
.It Fl c , Fl Fl context
@@ -177,6 +186,10 @@ See also
Forces
.Nm
to interpret the patch file as a normal diff.
+.It Fl Fl no-backup-if-mismatch
+Turn off
+.Fl Fl backup-if-mismatch .
+This option exists mostly for compatibility with GNU patch.
.It Fl o Ar out-file , Fl Fl output Ar out-file
Causes the next argument to be interpreted as the output file name.
.It Fl p Ar strip-count , Fl Fl strip Ar strip-count
@@ -604,7 +617,7 @@ utility is compliant with the
.St -p1003.1-2004
specification
(except as detailed above for the
-.Fl -posix
+.Fl Fl posix
option),
though the presence of
.Nm
@@ -613,7 +626,7 @@ itself is optional.
The flags
.Op Fl CEfstuvBFVxz
and
-.Op Fl -posix
+.Op Fl Fl posix
are extensions to that specification.
.Sh AUTHORS
.An Larry Wall