

How to use and make QuakeC patch files
by Jeff Epler <jepler@inetnebr.com>
29 September 1996

This is a draft, and probably isn't that great an explanation.  Please
mail me with questions about the directions, or suggestions on how to
improve this document.

Some parts of this document were contributed by Kyle R. Hofmann
<rhofmann@crl.com>, and various other changes were also suggested via email.

You should always be able to find the newest version of this document
at URL:http://incolor.inetnebr.com/jepler/howpatch.txt.  If I take
the time to make a hypertext version of this file, it will be at
URL:http://incolor.inetnebr.com/jepler/howpatch.html.  This file is also
uploaded to ftp.cdrom.com.

How to use QuakeC patch files
-----------------------------

   Get and install a version of patch suitable for your OS.  Under most
   unicies, (including Linux) this is already available.  For DOS, you
   want
    ftp://oak.oakland.edu/pub/simtelnet/gnu/djgpp/v2gnu/pat21b.zip
    ftp://ftp.simtelnet.com/pub/simtelnet/gnu/djgpp/v2gnu/pat21b.zip
   I don't know where a windows 95/nt version of patch resides, but the
   DOS version should execute just fine.  If you want to compile your own
   version of patch, get it from
     ftp://prep.ai.mit.edu/pub/gnu/diffutils-2.7.tar.gz

   Get a version of qcc suitable for your OS.  Look around at
    ftp://ftp.cdrom.com/pub/idgames/idstuff/source or
    ftp://ftp.cdrom.com/pub/idgames2/quakec or
    ftp://ftp.cdrom.com/pub/idgames2/utils for one.

   Get a patch file.  One such file will reside at
    ftp://ftp.cdrom.com/pub/idgames2/quakec/monsters/friend.zip
   Unzip it, and you'll get friend.pat.

   Put the patch.exe and qccdos.exe files in a directory in your PATH.

   Make a new directory and copy the unchanged files from v101qc to this
   new directory.  Change to the new directory.  Unzip the patch file
   (friend.zip) here, or move it from where you unzipped it. (If you are
   smart or willing to spend much time, you can add several patches to
   the same source, getting all the features.  However, there are likely
   to be rejects [see below] or unwanted side effects of putting several
   patches together)

     patch < friend.pat or
     type friend.pat | patch

   Inspect the directory for any "rejected" patches.  If there are some,
   you should use your favorite editor to inspect the reject file (named
   under unix whatever.qc.rej, and under DOS whatever.qc#) and make by
   hand the changes that are required.  ! marks lines changed between
   old and new versions, with old version shown first.  ("Unified"
   patches use one section and + and - to show changed lines instead
   of 2 seconds and !) Ideally, you should have no rejected patches.
   If you have many rejected patches, your command-line may have been
   wrong for patch.  Files ending in ~ are backups of files changed by
   the patch, and can generally be deleted.

   Run qcc to compile a new progs.dat (depending on the setup, progs.dat
   may be created in the current directory or the parent directory.
   Change the first line in progs.src to move where progs.dat will be
   created), copy it to quake\whatever, and run quake -game whatever.
   You're done.

   To undo a patch, use the command

     patch -R < friend.pat

   Make sure you type an uppercase R.

Errors installing QuakeC patches
--------------------------------

  patch is not a perfect utility.  If the QuakeC source which you are
trying to patch is already modified, or if the file has had lines added
or subtracted to it, you may get errors.  In serious cases, you may get
"rejected hunks", patches which could not be applied at all.  Warning and
errors include:

  - Offsets.  Offsets are nothing much to be concerned about, usually.
    They indicate that patch did not place the patch on the exact line
    specified; instead, patch placed the patch several lines away.  This
    is usually indicative of previously changed QuakeC sources, and in
    most cases may be safely ignored.  However, if there is an
    excessively large offset, you should check to make sure the patch has
    been applied properly.

  - Fuzz factor.  Fuzz factor indicates that the exact context could not
    be found, and so context lines at the beginning or end of the patch
    were ignored.  Be suspicious of patches which have a fuzz factor.
    Though they may be a result of changed sources, they can also be a
    result of an improperly applied or created patch.  Be sure to check
    to ensure that the patch is properly applied.

  - Rejected hunks.  Rejected hunks are sections of a patch which could
    not be applied at all.  They will be named foo.qc.rej or foo.qc#
    (replace foo with the filename of the .qc file which could not be
    patched).  They may be hand applied by going to the lines specified
    at the start of the hunk and the entire hunk being copied in.  If the
    hunk is part of a context diff, be sure to install the second half;
    that's the changed version (you can use the first half of the hunk
    to determine where the patch should be applied).  If the hunk is part
    of a unified diff, be sure to remove the sections with as - prefixing
    them and remove the + prefixing other lines (but do not remove the
    lines with the +'s)  However, be *extremely careful* --- rejected
    hunks may be completely incompatible with the code you currently have
    installed.

Installing multiple patch files
-------------------------------

   Installing multiple patch files is easy and simple.  Simply get both
   patches, and install them using the procedure listed above.  You will
   most likely encounter some of the errors listed above.  In this case, do
   not worry if it's simply a case of a minor offset.  Most likely the file
   has been modified by both patches and you're seeing a side effect.  Worry
   more if a fuzz factor is needed; it might indicate that the same portion
   of code is being modified by two patches.  Worry most when a hunk is
   rejected --- that usually indicates that the exact same portion of code
   was modified by both patches.  It might make the two incompatible.
 

How to make QuakeC patch files
------------------------------

   Get and install a copy of diff for your machine.  For unix, again it's
   included.  For DOS, get
    ftp://oak.oakland.edu/pub/simtelnet/gnu/djgpp/v2gnu/dif271b.zip
    ftp://ftp.simtelnet.com/pub/simtelnet/gnu/djgpp/v2gnu/dif271b.zip
   Again, I don't know about w95/w32/wnt, except that the dos version
   should work in the dos box.

   Get a directory with your mods in it and a directory with v101qc source
   side by side.

   diff -ur --new-file v101qc yourdir > yourdir.pat

   zip or otherwise compress yourdir.pat

   Share with the world.

   You should probably always diff against v101qc sources unless you have
   a good reason not to.  When you diff against v101qc, anyone can use
   those files and your .pat file to get a replica of your sources.  One
   time to use a different set of 'old' files would be something like this:

     John Doe made code for a weapon that turned monsters into little dogs.
     The only problem is that his files don't quite work -- Ammo can be
     turned into a dog too.  You fix this up and want to let John know.  So
     you make a diff like this (His source is in the directory jdgun, and
     your fixed version is in the directory yourgun):

     diff -ur --new-file jdgun yourgun > yourgun.pat

     Now, John Doe can see the differences between his gun code and your
     gun code, and as a bonus the file is smaller.  You could also hand it
     out to people who have his original gun diff as well.

Other problems
--------------

If you get an error about being unable to create a file /tmp/paaaax
(For instance), just create a \TMP directory on the drive where you were
trying to run patch.

If you get an error about DPMI, copy cwsdpmi.exe from the quake directory 
onto your path.

-------------------------------------------------------------------------------




This is Info file diff.info, produced by Makeinfo-1.63 from the input
file diff.texinfo.

   This file documents the the GNU `diff', `diff3', `sdiff', and `cmp'
commands for showing the differences between text files and the `patch'
command for using their output to update files.

   Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.

   Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

   Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.

   Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Foundation.


Tips for Making Patch Distributions
***********************************

   Here are some things you should keep in mind if you are going to
distribute patches for updating a software package.

   Make sure you have specified the file names correctly, either in a
context diff header or with an `Index:' line.  If you are patching
files in a subdirectory, be sure to tell the patch user to specify a
`-p' or `--strip' option as needed.  Take care to not send out reversed
patches, since these make people wonder whether they have already
applied the patch.

   To save people from partially applying a patch before other patches
that should have gone before it, you can make the first patch in the
patch file update a file with a name like `patchlevel.h' or
`version.c', which contains a patch level or version number.  If the
input file contains the wrong version number, `patch' will complain
immediately.

   An even clearer way to prevent this problem is to put a `Prereq:'
line before the patch.  If the leading text in the patch file contains a
line that starts with `Prereq:', `patch' takes the next word from that
line (normally a version number) and checks whether the next input file
contains that word, preceded and followed by either white space or a
newline.  If not, `patch' prompts you for confirmation before
proceeding.  This makes it difficult to accidentally apply patches in
the wrong order.

   Since `patch' does not handle incomplete lines properly, make sure
that all the source files in your program end with a newline whenever
you release a version.

   To create a patch that changes an older version of a package into a
newer version, first make a copy of the older version in a scratch
directory.  Typically you do that by unpacking a `tar' or `shar'
archive of the older version.

   You might be able to reduce the size of the patch by renaming or
removing some files before making the patch.  If the older version of
the package contains any files that the newer version does not, or if
any files have been renamed between the two versions, make a list of
`rm' and `mv' commands for the user to execute in the old version
directory before applying the patch.  Then run those commands yourself
in the scratch directory.

   If there are any files that you don't need to include in the patch
because they can easily be rebuilt from other files (for example,
`TAGS' and output from `yacc' and `makeinfo'), replace the versions in
the scratch directory with the newer versions, using `rm' and `ln' or
`cp'.

   Now you can create the patch.  The de-facto standard `diff' format
for patch distributions is context format with two lines of context,
produced by giving `diff' the `-C 2' option.  Do not use less than two
lines of context, because `patch' typically needs at least two lines
for proper operation.  Give `diff' the `-P' option in case the newer
version of the package contains any files that the older one does not.
Make sure to specify the scratch directory first and the newer
directory second.

   Add to the top of the patch a note telling the user any `rm' and
`mv' commands to run before applying the patch.  Then you can remove
the scratch directory.

Invoking `diff'
***************

   The format for running the `diff' command is:

     diff OPTIONS... FROM-FILE TO-FILE

   In the simplest case, `diff' compares the contents of the two files
FROM-FILE and TO-FILE.  A file name of `-' stands for text read from
the standard input.  As a special case, `diff - -' compares a copy of
standard input to itself.

   If FROM-FILE is a directory and TO-FILE is not, `diff' compares the
file in FROM-FILE whose file name is that of TO-FILE, and vice versa.
The non-directory file must not be `-'.

   If both FROM-FILE and TO-FILE are directories, `diff' compares
corresponding files in both directories, in alphabetical order; this
comparison is not recursive unless the `-r' or `--recursive' option is
given.  `diff' never compares the actual contents of a directory as if
it were a file.  The file that is fully specified may not be standard
input, because standard input is nameless and the notion of "file with
the same name" does not apply.

   `diff' options begin with `-', so normally FROM-FILE and TO-FILE may
not begin with `-'.  However, `--' as an argument by itself treats the
remaining arguments as file names even if they begin with `-'.

   An exit status of 0 means no differences were found, 1 means some
differences were found, and 2 means trouble.

* Menu:

* diff Options::	Summary of options to `diff'.


Options to `diff'
=================

   Below is a summary of all of the options that GNU `diff' accepts.
Most options have two equivalent names, one of which is a single letter
preceded by `-', and the other of which is a long name preceded by
`--'.  Multiple single letter options (unless they take an argument)
can be combined into a single command line word: `-ac' is equivalent to
`-a -c'.  Long named options can be abbreviated to any unique prefix of
their name.  Brackets ([ and ]) indicate that an option takes an
optional argument.

`-LINES'
     Show LINES (an integer) lines of context.  This option does not
     specify an output format by itself; it has no effect unless it is
     combined with `-c' (*note Context Format::.) or `-u' (*note
     Unified Format::.).  This option is obsolete.  For proper
     operation, `patch' typically needs at least two lines of context.

`-a'
     Treat all files as text and compare them line-by-line, even if they
     do not seem to be text.  *Note Binary::.

`-b'
     Ignore changes in amount of white space.  *Note White Space::.

`-B'
     Ignore changes that just insert or delete blank lines.  *Note
     Blank Lines::.

`--binary'
     Read and write data in binary mode.  *Note Binary::.

`--brief'
     Report only whether the files differ, not the details of the
     differences.  *Note Brief::.

`-c'
     Use the context output format.  *Note Context Format::.

`-C LINES'
`--context[=LINES]'
     Use the context output format, showing LINES (an integer) lines of
     context, or three if LINES is not given.  *Note Context Format::.
     For proper operation, `patch' typically needs at least two lines of
     context.

`--changed-group-format=FORMAT'
     Use FORMAT to output a line group containing differing lines from
     both files in if-then-else format.  *Note Line Group Formats::.

`-d'
     Change the algorithm perhaps find a smaller set of changes.  This
     makes `diff' slower (sometimes much slower).  *Note diff
     Performance::.

`-D NAME'
     Make merged `#ifdef' format output, conditional on the preprocessor
     macro NAME.  *Note If-then-else::.

`-e'
`--ed'
     Make output that is a valid `ed' script.  *Note ed Scripts::.

`--exclude=PATTERN'
     When comparing directories, ignore files and subdirectories whose
     basenames match PATTERN.  *Note Comparing Directories::.

`--exclude-from=FILE'
     When comparing directories, ignore files and subdirectories whose
     basenames match any pattern contained in FILE.  *Note Comparing
     Directories::.

`--expand-tabs'
     Expand tabs to spaces in the output, to preserve the alignment of
     tabs in the input files.  *Note Tabs::.

`-f'
     Make output that looks vaguely like an `ed' script but has changes
     in the order they appear in the file.  *Note Forward ed::.

`-F REGEXP'
     In context and unified format, for each hunk of differences, show
     some of the last preceding line that matches REGEXP.  *Note
     Specified Headings::.

`--forward-ed'
     Make output that looks vaguely like an `ed' script but has changes
     in the order they appear in the file.  *Note Forward ed::.

`-h'
     This option currently has no effect; it is present for Unix
     compatibility.

`-H'
     Use heuristics to speed handling of large files that have numerous
     scattered small changes.  *Note diff Performance::.

`--horizon-lines=LINES'
     Do not discard the last LINES lines of the common prefix and the
     first LINES lines of the common suffix.  *Note diff Performance::.

`-i'
     Ignore changes in case; consider upper- and lower-case letters
     equivalent.  *Note Case Folding::.

`-I REGEXP'
     Ignore changes that just insert or delete lines that match REGEXP.
     *Note Specified Folding::.

`--ifdef=NAME'
     Make merged if-then-else output using NAME.  *Note If-then-else::.

`--ignore-all-space'
     Ignore white space when comparing lines.  *Note White Space::.

`--ignore-blank-lines'
     Ignore changes that just insert or delete blank lines.  *Note
     Blank Lines::.

`--ignore-case'
     Ignore changes in case; consider upper- and lower-case to be the
     same.  *Note Case Folding::.

`--ignore-matching-lines=REGEXP'
     Ignore changes that just insert or delete lines that match REGEXP.
     *Note Specified Folding::.

`--ignore-space-change'
     Ignore changes in amount of white space.  *Note White Space::.

`--initial-tab'
     Output a tab rather than a space before the text of a line in
     normal or context format.  This causes the alignment of tabs in
     the line to look normal.  *Note Tabs::.

`-l'
     Pass the output through `pr' to paginate it.  *Note Pagination::.

`-L LABEL'
     Use LABEL instead of the file name in the context format (*note
     Context Format::.) and unified format (*note Unified Format::.)
     headers.  *Note RCS::.

`--label=LABEL'
     Use LABEL instead of the file name in the context format (*note
     Context Format::.) and unified format (*note Unified Format::.)
     headers.

`--left-column'
     Print only the left column of two common lines in side by side
     format.  *Note Side by Side Format::.

`--line-format=FORMAT'
     Use FORMAT to output all input lines in if-then-else format.
     *Note Line Formats::.

`--minimal'
     Change the algorithm to perhaps find a smaller set of changes.
     This makes `diff' slower (sometimes much slower).  *Note diff
     Performance::.

`-n'
     Output RCS-format diffs; like `-f' except that each command
     specifies the number of lines affected.  *Note RCS::.

`-N'
`--new-file'
     In directory comparison, if a file is found in only one directory,
     treat it as present but empty in the other directory.  *Note
     Comparing Directories::.

`--new-group-format=FORMAT'
     Use FORMAT to output a group of lines taken from just the second
     file in if-then-else format.  *Note Line Group Formats::.

`--new-line-format=FORMAT'
     Use FORMAT to output a line taken from just the second file in
     if-then-else format.  *Note Line Formats::.

`--old-group-format=FORMAT'
     Use FORMAT to output a group of lines taken from just the first
     file in if-then-else format.  *Note Line Group Formats::.

`--old-line-format=FORMAT'
     Use FORMAT to output a line taken from just the first file in
     if-then-else format.  *Note Line Formats::.

`-p'
     Show which C function each change is in.  *Note C Function
     Headings::.

`-P'
     When comparing directories, if a file appears only in the second
     directory of the two, treat it as present but empty in the other.
     *Note Comparing Directories::.

`--paginate'
     Pass the output through `pr' to paginate it.  *Note Pagination::.

`-q'
     Report only whether the files differ, not the details of the
     differences.  *Note Brief::.

`-r'
     When comparing directories, recursively compare any subdirectories
     found.  *Note Comparing Directories::.

`--rcs'
     Output RCS-format diffs; like `-f' except that each command
     specifies the number of lines affected.  *Note RCS::.

`--recursive'
     When comparing directories, recursively compare any subdirectories
     found.  *Note Comparing Directories::.

`--report-identical-files'
     Report when two files are the same.  *Note Comparing Directories::.

`-s'
     Report when two files are the same.  *Note Comparing Directories::.

`-S FILE'
     When comparing directories, start with the file FILE.  This is
     used for resuming an aborted comparison.  *Note Comparing
     Directories::.

`--sdiff-merge-assist'
     Print extra information to help `sdiff'.  `sdiff' uses this option
     when it runs `diff'.  This option is not intended for users to use
     directly.

`--show-c-function'
     Show which C function each change is in.  *Note C Function
     Headings::.

`--show-function-line=REGEXP'
     In context and unified format, for each hunk of differences, show
     some of the last preceding line that matches REGEXP.  *Note
     Specified Headings::.

`--side-by-side'
     Use the side by side output format.  *Note Side by Side Format::.

`--speed-large-files'
     Use heuristics to speed handling of large files that have numerous
     scattered small changes.  *Note diff Performance::.

`--starting-file=FILE'
     When comparing directories, start with the file FILE.  This is
     used for resuming an aborted comparison.  *Note Comparing
     Directories::.

`--suppress-common-lines'
     Do not print common lines in side by side format.  *Note Side by
     Side Format::.

`-t'
     Expand tabs to spaces in the output, to preserve the alignment of
     tabs in the input files.  *Note Tabs::.

`-T'
     Output a tab rather than a space before the text of a line in
     normal or context format.  This causes the alignment of tabs in
     the line to look normal.  *Note Tabs::.

`--text'
     Treat all files as text and compare them line-by-line, even if they
     do not appear to be text.  *Note Binary::.

`-u'
     Use the unified output format.  *Note Unified Format::.

`--unchanged-group-format=FORMAT'
     Use FORMAT to output a group of common lines taken from both files
     in if-then-else format.  *Note Line Group Formats::.

`--unchanged-line-format=FORMAT'
     Use FORMAT to output a line common to both files in if-then-else
     format.  *Note Line Formats::.

`--unidirectional-new-file'
     When comparing directories, if a file appears only in the second
     directory of the two, treat it as present but empty in the other.
     *Note Comparing Directories::.

`-U LINES'
`--unified[=LINES]'
     Use the unified output format, showing LINES (an integer) lines of
     context, or three if LINES is not given.  *Note Unified Format::.
     For proper operation, `patch' typically needs at least two lines of
     context.

`-v'
`--version'
     Output the version number of `diff'.

`-w'
     Ignore white space when comparing lines.  *Note White Space::.

`-W COLUMNS'
`--width=COLUMNS'
     Use an output width of COLUMNS in side by side format.  *Note Side
     by Side Format::.

`-x PATTERN'
     When comparing directories, ignore files and subdirectories whose
     basenames match PATTERN.  *Note Comparing Directories::.

`-X FILE'
     When comparing directories, ignore files and subdirectories whose
     basenames match any pattern contained in FILE.  *Note Comparing
     Directories::.

`-y'
     Use the side by side output format.  *Note Side by Side Format::.


Invoking `patch'
****************

   Normally `patch' is invoked like this:

     patch <PATCHFILE

   The full format for invoking `patch' is:

     patch OPTIONS... [ORIGFILE [PATCHFILE]] [+ OPTIONS... [ORIGFILE]]...

   If you do not specify PATCHFILE, or if PATCHFILE is `-', `patch'
reads the patch (that is, the `diff' output) from the standard input.

   You can specify one or more of the original files as ORIG arguments;
each one and options for interpreting it is separated from the others
with a `+'.  *Note Multiple Patches::, for more information.

   If you do not specify an input file on the command line, `patch'
tries to figure out from the "leading text" (any text in the patch that
comes before the `diff' output) which file to edit.  In the header of a
context or unified diff, `patch' looks in lines beginning with `***',
`---', or `+++'; among those, it chooses the shortest name of an
existing file.  Otherwise, if there is an `Index:' line in the leading
text, `patch' tries to use the file name from that line.  If `patch'
cannot figure out the name of an existing file from the leading text,
it prompts you for the name of the file to patch.

   If the input file does not exist or is read-only, and a suitable RCS
or SCCS file exists, `patch' attempts to check out or get the file
before proceeding.

   By default, `patch' replaces the original input file with the
patched version, after renaming the original file into a backup file
(*note Backups::., for a description of how `patch' names backup
files).  You can also specify where to put the output with the `-o
OUTPUT-FILE' or `--output=OUTPUT-FILE' option.

* Menu:

* patch Directories::	Changing directory and stripping directories.
* Backups::		Backup file names.
* Rejects::		Reject file names.
* patch Options::	Summary table of options to `patch'.


Applying Patches in Other Directories
=====================================

   The `-d DIRECTORY' or `--directory=DIRECTORY' option to `patch'
makes directory DIRECTORY the current directory for interpreting both
file names in the patch file, and file names given as arguments to
other options (such as `-B' and `-o').  For example, while in a news
reading program, you can patch a file in the `/usr/src/emacs' directory
directly from the article containing the patch like this:

     | patch -d /usr/src/emacs

   Sometimes the file names given in a patch contain leading
directories, but you keep your files in a directory different from the
one given in the patch.  In those cases, you can use the `-p[NUMBER]'
or `--strip[=NUMBER]' option to set the file name strip count to
NUMBER.  The strip count tells `patch' how many slashes, along with the
directory names between them, to strip from the front of file names.
`-p' with no NUMBER given is equivalent to `-p0'.  By default, `patch'
strips off all leading directories, leaving just the base file names,
except that when a file name given in the patch is a relative file name
and all of its leading directories already exist, `patch' does not
strip off the leading directory.  (A "relative" file name is one that
does not start with a slash.)

   `patch' looks for each file (after any slashes have been stripped)
in the current directory, or if you used the `-d DIRECTORY' option, in
that directory.

   For example, suppose the file name in the patch file is
`/gnu/src/emacs/etc/NEWS'.  Using `-p' or `-p0' gives the entire file
name unmodified, `-p1' gives `gnu/src/emacs/etc/NEWS' (no leading
slash), `-p4' gives `etc/NEWS', and not specifying `-p' at all gives
`NEWS'.


Backup File Names
=================

   Normally, `patch' renames an original input file into a backup file
by appending to its name the extension `.orig', or `~' on systems that
do not support long file names.  The `-b BACKUP-SUFFIX' or
`--suffix=BACKUP-SUFFIX' option uses BACKUP-SUFFIX as the backup
extension instead.

   Alternately, you can specify the extension for backup files with the
`SIMPLE_BACKUP_SUFFIX' environment variable, which the options override.

   `patch' can also create numbered backup files the way GNU Emacs
does.  With this method, instead of having a single backup of each file,
`patch' makes a new backup file name each time it patches a file.  For
example, the backups of a file named `sink' would be called,
successively, `sink.~1~', `sink.~2~', `sink.~3~', etc.

   The `-V BACKUP-STYLE' or `--version-control=BACKUP-STYLE' option
takes as an argument a method for creating backup file names.  You can
alternately control the type of backups that `patch' makes with the
`VERSION_CONTROL' environment variable, which the `-V' option
overrides.  The value of the `VERSION_CONTROL' environment variable and
the argument to the `-V' option are like the GNU Emacs
`version-control' variable (*note emacs: Backups., for more information
on backup versions in Emacs).  They also recognize synonyms that are
more descriptive.  The valid values are listed below; unique
abbreviations are acceptable.

`t'
`numbered'
     Always make numbered backups.

`nil'
`existing'
     Make numbered backups of files that already have them, simple
     backups of the others.  This is the default.

`never'
`simple'
     Always make simple backups.

   Alternately, you can tell `patch' to prepend a prefix, such as a
directory name, to produce backup file names.  The `-B BACKUP-PREFIX'
or `--prefix=BACKUP-PREFIX' option makes backup files by prepending
BACKUP-PREFIX to them.  If you use this option, `patch' ignores any
`-b' option that you give.

   If the backup file already exists, `patch' creates a new backup file
name by changing the first lowercase letter in the last component of
the file name into uppercase.  If there are no more lowercase letters
in the name, it removes the first character from the name.  It repeats
this process until it comes up with a backup file name that does not
already exist.

   If you specify the output file with the `-o' option, that file is
the one that is backed up, not the input file.


Reject File Names
=================

   The names for reject files (files containing patches that `patch'
could not find a place to apply) are normally the name of the output
file with `.rej' appended (or `#' on systems that do not support long
file names).

   Alternatively, you can tell `patch' to place all of the rejected
patches in a single file.  The `-r REJECT-FILE' or
`--reject-file=REJECT-FILE' option uses REJECT-FILE as the reject file
name.


Options to `patch'
==================

   Here is a summary of all of the options that `patch' accepts.  Older
versions of `patch' do not accept long-named options or the `-t', `-E',
or `-V' options.

   Multiple single-letter options that do not take an argument can be
combined into a single command line argument (with only one dash).
Brackets ([ and ]) indicate that an option takes an optional argument.

`-b BACKUP-SUFFIX'
     Use BACKUP-SUFFIX as the backup extension instead of `.orig' or
     `~'.  *Note Backups::.

`-B BACKUP-PREFIX'
     Use BACKUP-PREFIX as a prefix to the backup file name.  If this
     option is specified, any `-b' option is ignored.  *Note Backups::.

`--batch'
     Do not ask any questions.  *Note patch Messages::.

`-c'
`--context'
     Interpret the patch file as a context diff.  *Note patch Input::.

`-d DIRECTORY'
`--directory=DIRECTORY'
     Makes directory DIRECTORY the current directory for interpreting
     both file names in the patch file, and file names given as
     arguments to other options.  *Note patch Directories::.

`-D NAME'
     Make merged if-then-else output using FORMAT.  *Note
     If-then-else::.

`--debug=NUMBER'
     Set internal debugging flags.  Of interest only to `patch'
     patchers.

`-e'
`--ed'
     Interpret the patch file as an `ed' script.  *Note patch Input::.

`-E'
     Remove output files that are empty after the patches have been
     applied.  *Note Empty Files::.

`-f'
     Assume that the user knows exactly what he or she is doing, and do
     not ask any questions.  *Note patch Messages::.

`-F LINES'
     Set the maximum fuzz factor to LINES.  *Note Inexact::.

`--force'
     Assume that the user knows exactly what he or she is doing, and do
     not ask any questions.  *Note patch Messages::.

`--forward'
     Ignore patches that `patch' thinks are reversed or already applied.
     See also `-R'.  *Note Reversed Patches::.

`--fuzz=LINES'
     Set the maximum fuzz factor to LINES.  *Note Inexact::.

`--help'
     Print a summary of the options that `patch' recognizes, then exit.

`--ifdef=NAME'
     Make merged if-then-else output using FORMAT.  *Note
     If-then-else::.

`--ignore-white-space'
`-l'
     Let any sequence of white space in the patch file match any
     sequence of white space in the input file.  *Note Changed White
     Space::.

`-n'
`--normal'
     Interpret the patch file as a normal diff.  *Note patch Input::.

`-N'
     Ignore patches that `patch' thinks are reversed or already applied.
     See also `-R'.  *Note Reversed Patches::.

`-o OUTPUT-FILE'
`--output=OUTPUT-FILE'
     Use OUTPUT-FILE as the output file name.  *Note patch Options::.

`-p[NUMBER]'
     Set the file name strip count to NUMBER.  *Note patch
     Directories::.

`--prefix=BACKUP-PREFIX'
     Use BACKUP-PREFIX as a prefix to the backup file name.  If this
     option is specified, any `-b' option is ignored.  *Note Backups::.

`--quiet'
     Work silently unless an error occurs.  *Note patch Messages::.

`-r REJECT-FILE'
     Use REJECT-FILE as the reject file name.  *Note Rejects::.

`-R'
     Assume that this patch was created with the old and new files
     swapped.  *Note Reversed Patches::.

`--reject-file=REJECT-FILE'
     Use REJECT-FILE as the reject file name.  *Note Rejects::.

`--remove-empty-files'
     Remove output files that are empty after the patches have been
     applied.  *Note Empty Files::.

`--reverse'
     Assume that this patch was created with the old and new files
     swapped.  *Note Reversed Patches::.

`-s'
     Work silently unless an error occurs.  *Note patch Messages::.

`-S'
     Ignore this patch from the patch file, but continue looking for
     the next patch in the file.  *Note Multiple Patches::.

`--silent'
     Work silently unless an error occurs.  *Note patch Messages::.

`--skip'
     Ignore this patch from the patch file, but continue looking for
     the next patch in the file.  *Note Multiple Patches::.

`--strip[=NUMBER]'
     Set the file name strip count to NUMBER.  *Note patch
     Directories::.

`--suffix=BACKUP-SUFFIX'
     Use BACKUP-SUFFIX as the backup extension instead of `.orig' or
     `~'.  *Note Backups::.

`-t'
     Do not ask any questions.  *Note patch Messages::.

`-u'
`--unified'
     Interpret the patch file as a unified diff.  *Note patch Input::.

`-v'
     Output the revision header and patch level of `patch'.

`-V BACKUP-STYLE'
     Select the kind of backups to make.  *Note Backups::.

`--version'
     Output the revision header and patch level of `patch', then exit.

`--version=control=BACKUP-STYLE'
     Select the kind of backups to make.  *Note Backups::.

`-x NUMBER'
     Set internal debugging flags.  Of interest only to `patch'
     patchers.


Reporting Bugs
==============

   If you think you have found a bug in GNU `cmp', `diff', `diff3',
`sdiff', or `patch', please report it by electronic mail to
`bug-gnu-utils@prep.ai.mit.edu'.  Send as precise a description of the
problem as you can, including sample input files that produce the bug,
if applicable.

   Because Larry Wall has not released a new version of `patch' since
mid 1988 and the GNU version of `patch' has been changed since then,
please send bug reports for `patch' by electronic mail to both
`bug-gnu-utils@prep.ai.mit.edu' and `lwall@netlabs.com'.

