summaryrefslogtreecommitdiff
path: root/patch.man
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2009-03-12 15:17:03 +0100
committerAndreas Gruenbacher <agruen@suse.de>2009-03-12 15:17:03 +0100
commit957f7b6423cc7a1f87e7e6a4cb4b41c46821d804 (patch)
tree855171939850bf86108373184ded91ca626af337 /patch.man
parent6b2b4620383eb47f4979b936b266708ed7812788 (diff)
downloadpatch-957f7b6423cc7a1f87e7e6a4cb4b41c46821d804.tar.gz
Import of patch-2.5.3.tar.gzv2.5.3
Diffstat (limited to 'patch.man')
-rw-r--r--patch.man189
1 files changed, 137 insertions, 52 deletions
diff --git a/patch.man b/patch.man
index e3589ba..d7190cb 100644
--- a/patch.man
+++ b/patch.man
@@ -2,7 +2,7 @@
.de Id
.ds Dt \\$4
..
-.Id $Id: patch.man,v 1.23 1997/07/16 12:26:36 eggert Exp $
+.Id $Id: patch.man,v 1.25 1998/03/17 18:35:38 eggert Exp $
.ds = \-\^\-
.de Sp
.if t .sp .3
@@ -66,7 +66,8 @@ diff listing to
.BR patch ,
and it should work.
If the entire diff is indented by a consistent amount,
-or if a context diff is encapsulated one or more times by prepending
+or if a context diff contains lines ending in \s-1CRLF\s0
+or is encapsulated one or more times by prepending
"\fB\- \fP" to lines starting with "\fB\-\fP" as specified by Internet RFC 934,
this is taken into account.
.PP
@@ -136,22 +137,31 @@ is specified on the command line,
.B patch
tries to figure out from the leading garbage what the name of the file
to edit is, using the following rules.
+.LP
+First,
+.B patch
+takes an ordered list of candidate file names as follows:
.TP 3
.B " \(bu"
If the header is that of a context diff,
.B patch
takes the old and new file names in the header.
-Any
+A name is ignored if it does not have enough slashes to satisfy the
+.BI \-p num
+or
+.BI \*=strip= num
+option.
+The name
.B /dev/null
-names are ignored.
+is also ignored.
.TP
.B " \(bu"
If there is an
.B Index:\&
line in the leading garbage
-and if either the old and new names are both absent or the
-.B POSIXLY_CORRECT
-environment variable is set,
+and if either the old and new names are both absent or if
+.B patch
+is conforming to \s-1POSIX\s0,
.B patch
takes the name in the
.B Index:\&
@@ -159,39 +169,47 @@ line.
.TP
.B " \(bu"
For the purpose of the following rules,
-the names are considered to be in the order (old, new, index),
+the candidate file names are considered to be in the order (old, new, index),
regardless of the order that they appear in the header.
-.TP
+.LP
+Then
+.B patch
+selects a file name from the candidate list as follows:
+.TP 3
.B " \(bu"
If some of the named files exist,
.B patch
-uses the first name if the
-.B POSIXLY_CORRECT
-environment variable is set, and the best name otherwise.
+selects the first name if conforming to \s-1POSIX\s0,
+and the best name otherwise.
.TP
.B " \(bu"
If
.B patch
-is not ignoring \s-1RCS\s0 and \s-1SCCS\s0 (see the
+is not ignoring \s-1RCS\s0, ClearCase, and \s-1SCCS\s0 (see the
.BI "\-g\ " num
or
.BI \*=get= num
option), and no named files exist
-but an \s-1RCS\s0 or \s-1SCCS\s0 master is found,
+but an \s-1RCS\s0, ClearCase, or \s-1SCCS\s0 master is found,
.B patch
-uses the first named file with an \s-1RCS\s0 or \s-1SCCS\s0 master.
+selects the first named file
+with an \s-1RCS\s0, ClearCase, or \s-1SCCS\s0 master.
.TP
.B " \(bu"
-If no named files exist, no \s-1RCS\s0 or \s-1SCCS\s0 master was found,
+If no named files exist,
+no \s-1RCS\s0, ClearCase, or \s-1SCCS\s0 master was found,
some names are given,
-.B POSIXLY_CORRECT
-is not set, and the patch appears to create a file,
.B patch
-uses the best name requiring the creation of the fewest directories.
+is not conforming to \s-1POSIX\s0,
+and the patch appears to create a file,
+.B patch
+selects the best name requiring the creation of the fewest directories.
.TP
.B " \(bu"
If no file name results from the above heuristics, you are asked
-for the name of the file to patch.
+for the name of the file to patch, and
+.B patch
+selects that name.
.LP
To determine the
.I best
@@ -248,16 +266,16 @@ option for details about how backup file names are determined.
.B \*=backup\-if\-mismatch
Back up a file if the patch does not match the file exactly
and if backups are not otherwise requested.
-This is the default unless the
-.B POSIXLY_CORRECT
-environment variable is set.
+This is the default unless
+.B patch
+is conforming to \s-1POSIX\s0.
.TP
.B \*=no\-backup\-if\-mismatch
Do not back up a file if the patch does not match the file exactly
and if backups are not otherwise requested.
-This is the default if the
-.B POSIXLY_CORRECT
-environment variable is set.
+This is the default if
+.B patch
+is conforming to \s-1POSIX\s0.
.TP
\fB\-B\fP \fIpref\fP or \fB\*=prefix=\fP\fIpref\fP
Prefix
@@ -274,7 +292,7 @@ is
Read and write all files in binary mode,
except for standard output and
.BR /dev/tty .
-This option has no effect on \s-1POSIX\s0-compliant systems.
+This option has no effect on \s-1POSIX\s0-conforming systems.
On systems like \s-1DOS\s0 where this option makes a difference,
the patch should be generated by
.BR "diff\ \-a\ \*=binary" .
@@ -309,9 +327,9 @@ Normally this option is unnecessary, since
.B patch
can examine the time stamps on the header to determine whether a file
should exist after patching.
-However, if the input is not a context diff or if the
-.B POSIXLY_CORRECT
-environment variable is set,
+However, if the input is not a context diff or if
+.B patch
+is conforming to \s-1POSIX\s0,
.B patch
does not remove empty patched files unless this option is given.
When
@@ -343,21 +361,23 @@ the number of lines of context in the context diff, ordinarily 3.
This option controls
.BR patch 's
actions when a file is under \s-1RCS\s0 or \s-1SCCS\s0 control,
-and does not exist or is read-only and matches the default version.
+and does not exist or is read-only and matches the default version,
+or when a file is under ClearCase control and does not exist.
If
.I num
is positive,
.B patch
gets (or checks out) the file from the revision control system; if zero,
.B patch
-ignores \s-1RCS\s0 and \s-1SCCS\s0 and does not get the file; and if negative,
+ignores \s-1RCS\s0, ClearCase, and \s-1SCCS\s0
+and does not get the file; and if negative,
.B patch
asks the user whether to get the file.
The default value of this option is given by the value of the
.B PATCH_GET
environment variable if it is set; if not, the default value is zero if
-.B POSIXLY_CORRECT
-is set, negative otherwise.
+.B patch
+is conforming to \s-1POSIX\s0, negative otherwise.
.TP
.B "\*=help"
Print a summary of options and exit.
@@ -426,6 +446,62 @@ or the directory specified by the
.B \-d
option.
.TP
+.B \*=posix
+Conform more strictly to the \s-1POSIX\s0 standard, as follows.
+.RS
+.TP 3
+.B " \(bu"
+Take the first existing file from the list (old, new, index)
+when intuiting file names from diff headers.
+.TP
+.B " \(bu"
+Do not remove files that are empty after patching.
+.TP
+.B " \(bu"
+Do not ask whether to get files from \s-1RCS\s0, ClearCase, or \s-1SCCS\s0.
+.TP
+.B " \(bu"
+Require that all options precede the files in the command line.
+.TP
+.B " \(bu"
+Do not backup files when there is a mismatch.
+.RE
+.TP
+.BI \*=quoting\-style= word
+Use style
+.I word
+to quote output names.
+The
+.I word
+should be one of the following:
+.RS
+.TP
+.B literal
+Output names as-is.
+.TP
+.B shell
+Quote names for the shell if they contain shell metacharacters or would
+cause ambiguous output.
+.TP
+.B shell-always
+Quote names for the shell, even if they would normally not require quoting.
+.TP
+.B c
+Quote names as for a C language string.
+.TP
+.B escape
+Quote as with
+.B c
+except omit the surrounding double-quote characters.
+.LP
+You can specify the default value of the
+.B \*=quoting\-style
+option with the environment variable
+.BR QUOTING_STYLE .
+If that environment variable is not set, the default value is
+.BR shell .
+.RE
+.TP
\fB\-r\fP \fIrejectfile\fP or \fB\*=reject\-file=\fP\fIrejectfile\fP
Put rejects into
.I rejectfile
@@ -636,10 +712,10 @@ all files that depend on the patched files, so that later invocations of
do not get confused by the patched files' times.
.SH ENVIRONMENT
.TP 3
-\fBPATCH_GET\fP
+.B PATCH_GET
This specifies whether
.B patch
-gets missing or read-only files from \s-1RCS\s0 or \s-1SCCS\s0
+gets missing or read-only files from \s-1RCS\s0, ClearCase, or \s-1SCCS\s0
by default; see the
.B \-g
or
@@ -649,13 +725,15 @@ option.
.B POSIXLY_CORRECT
If set,
.B patch
-conforms more strictly to the \s-1POSIX\s0 standard:
-it takes the first existing file from the list (old, new, index)
-when intuiting file names from diff headers,
-it does not remove files that are empty after patching,
-it does not ask whether to get files from \s-1RCS\s0 or \s-1SCCS\s0,
-it requires that all options precede the files in the command line,
-and it does not backup files when there is a mismatch.
+conforms more strictly to the \s-1POSIX\s0 standard by default:
+see the
+.B \*=posix
+option.
+.TP
+.B QUOTING_STYLE
+Default value of the
+.B \*=quoting\-style
+option.
.TP
.B SIMPLE_BACKUP_SUFFIX
Extension to use for simple backup file names instead of
@@ -748,9 +826,9 @@ This only works if the file you want to create doesn't exist already in
the target directory.
Conversely, you can remove a file by sending out a context diff that compares
the file to be deleted with an empty file dated the Epoch.
-The file will be removed unless the
-.B POSIXLY_CORRECT
-environment variable is set and the
+The file will be removed unless
+.B patch
+is conforming to \s-1POSIX\s0 and the
.B \-E
or
.B \*=remove\-empty\-files
@@ -879,7 +957,7 @@ The \s-1POSIX\s0 standard specifies behavior that differs from
traditional behavior.
You should be aware of these differences if you must interoperate with
.B patch
-versions 2.1 and earlier, which are not \s-1POSIX\s0-compliant.
+versions 2.1 and earlier, which do not conform to \s-1POSIX\s0.
.TP 3
.B " \(bu"
In traditional
@@ -930,6 +1008,8 @@ In \s-1GNU\s0
.BR patch ,
this behavior is enabled with the
.B \*=no\-backup\-if\-mismatch
+option, or by conforming to \s-1POSIX\s0 with the
+.B \*=posix
option or by setting the
.B POSIXLY_CORRECT
environment variable.
@@ -949,11 +1029,11 @@ Traditional
.B patch
used a complicated (and incompletely documented) method
to intuit the name of the file to be patched from the patch header.
-This method was not \s-1POSIX\s0-compliant, and had a few gotchas.
+This method did not conform to \s-1POSIX\s0, and had a few gotchas.
Now
.B patch
uses a different, equally complicated (but better documented) method
-that is optionally \s-1POSIX\s0-compliant; we hope it has
+that is optionally \s-1POSIX\s0-conforming; we hope it has
fewer gotchas. The two methods are compatible if the
file names in the context diff header and the
.B Index:\&
@@ -994,8 +1074,9 @@ meant to be executed by anyone running \s-1GNU\s0
.BR patch ,
traditional
.BR patch ,
-or a \s-1POSIX\s0-compliant
-.BR patch .
+or a
+.B patch
+that conforms to \s-1POSIX\s0.
Spaces are significant in the following list, and operands are required.
.Sp
.nf
@@ -1015,6 +1096,9 @@ Spaces are significant in the following list, and operands are required.
.in
.fi
.SH BUGS
+Please report bugs via email to
+.BR <bug-gnu-utils@gnu.org> .
+.PP
.B patch
could be smarter about partial matches, excessively deviant offsets and
swapped code, but that would take an extra pass.
@@ -1036,7 +1120,8 @@ Copyright
.br
Copyright
.if t \(co
-1997 Free Software Foundation, Inc.
+1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
+Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice