home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 5
/
FreshFish_July-August1994.bin
/
bbs
/
gnu
/
diffutils-2.6-bin.lha
/
info
/
diff.info-3
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-07-11
|
47KB
|
918 lines
This is Info file diff.info, produced by Makeinfo-1.55 from the input
file ./diff.texi.
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 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.
File: diff.info, Node: Making Patches, Next: Invoking cmp, Prev: Merging with patch, Up: Top
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.
File: diff.info, Node: Invoking cmp, Next: Invoking diff, Prev: Making Patches, Up: Top
Invoking `cmp'
**************
The `cmp' command compares two files, and if they differ, tells the
first byte and line number where they differ. Its arguments are as
follows:
cmp OPTIONS... FROM-FILE [TO-FILE]
The file name `-' is always the standard input. `cmp' also uses the
standard input if one file name is omitted.
An exit status of 0 means no differences were found, 1 means some
differences were found, and 2 means trouble.
* Menu:
* cmp Options:: Summary of options to `cmp'.
File: diff.info, Node: cmp Options, Up: Invoking cmp
Options to `cmp'
================
Below is a summary of all of the options that GNU `cmp' 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: `-cl' is equivalent to
`-c -l'.
Print the differing characters. Display control characters as a
`^' followed by a letter of the alphabet and precede characters
that have the high bit set with `M-' (which stands for "meta").
`--ignore-initial=BYTES'
Ignore any differences in the the first BYTES bytes of the input
files. Treat files with fewer than BYTES bytes as if they are
empty.
Print the (decimal) offsets and (octal) values of all differing
bytes.
`--print-chars'
Print the differing characters. Display control characters as a
`^' followed by a letter of the alphabet and precede characters
that have the high bit set with `M-' (which stands for "meta").
`--quiet'
`--silent'
Do not print anything; only return an exit status indicating
whether the files differ.
`--verbose'
Print the (decimal) offsets and (octal) values of all differing
bytes.
`--version'
Output the version number of `cmp'.
File: diff.info, Node: Invoking diff, Next: Invoking diff3, Prev: Invoking cmp, Up: Top
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'.
File: diff.info, Node: diff Options, Up: Invoking 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 optio