home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / diff.info-3 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  47KB  |  919 lines

  1. This is Info file diff.info, produced by Makeinfo-1.55 from the input
  2. file ./diff.texi.
  3.    This file documents the the GNU `diff', `diff3', `sdiff', and `cmp'
  4. commands for showing the differences between text files and the `patch'
  5. command for using their output to update files.
  6.    Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided that
  12. the entire resulting derived work is distributed under the terms of a
  13. permission notice identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that this permission notice may be stated in a
  17. translation approved by the Foundation.
  18. File: diff.info,  Node: Making Patches,  Next: Invoking cmp,  Prev: Merging with patch,  Up: Top
  19. Tips for Making Patch Distributions
  20. ***********************************
  21.    Here are some things you should keep in mind if you are going to
  22. distribute patches for updating a software package.
  23.    Make sure you have specified the file names correctly, either in a
  24. context diff header or with an `Index:' line.  If you are patching
  25. files in a subdirectory, be sure to tell the patch user to specify a
  26. `-p' or `--strip' option as needed.  Take care to not send out reversed
  27. patches, since these make people wonder whether they have already
  28. applied the patch.
  29.    To save people from partially applying a patch before other patches
  30. that should have gone before it, you can make the first patch in the
  31. patch file update a file with a name like `patchlevel.h' or
  32. `version.c', which contains a patch level or version number.  If the
  33. input file contains the wrong version number, `patch' will complain
  34. immediately.
  35.    An even clearer way to prevent this problem is to put a `Prereq:'
  36. line before the patch.  If the leading text in the patch file contains a
  37. line that starts with `Prereq:', `patch' takes the next word from that
  38. line (normally a version number) and checks whether the next input file
  39. contains that word, preceded and followed by either white space or a
  40. newline.  If not, `patch' prompts you for confirmation before
  41. proceeding.  This makes it difficult to accidentally apply patches in
  42. the wrong order.
  43.    Since `patch' does not handle incomplete lines properly, make sure
  44. that all the source files in your program end with a newline whenever
  45. you release a version.
  46.    To create a patch that changes an older version of a package into a
  47. newer version, first make a copy of the older version in a scratch
  48. directory.  Typically you do that by unpacking a `tar' or `shar'
  49. archive of the older version.
  50.    You might be able to reduce the size of the patch by renaming or
  51. removing some files before making the patch.  If the older version of
  52. the package contains any files that the newer version does not, or if
  53. any files have been renamed between the two versions, make a list of
  54. `rm' and `mv' commands for the user to execute in the old version
  55. directory before applying the patch.  Then run those commands yourself
  56. in the scratch directory.
  57.    If there are any files that you don't need to include in the patch
  58. because they can easily be rebuilt from other files (for example,
  59. `TAGS' and output from `yacc' and `makeinfo'), replace the versions in
  60. the scratch directory with the newer versions, using `rm' and `ln' or
  61. `cp'.
  62.    Now you can create the patch.  The de-facto standard `diff' format
  63. for patch distributions is context format with two lines of context,
  64. produced by giving `diff' the `-C 2' option.  Do not use less than two
  65. lines of context, because `patch' typically needs at least two lines
  66. for proper operation.  Give `diff' the `-P' option in case the newer
  67. version of the package contains any files that the older one does not.
  68. Make sure to specify the scratch directory first and the newer
  69. directory second.
  70.    Add to the top of the patch a note telling the user any `rm' and
  71. `mv' commands to run before applying the patch.  Then you can remove
  72. the scratch directory.
  73. File: diff.info,  Node: Invoking cmp,  Next: Invoking diff,  Prev: Making Patches,  Up: Top
  74. Invoking `cmp'
  75. **************
  76.    The `cmp' command compares two files, and if they differ, tells the
  77. first byte and line number where they differ.  Its arguments are as
  78. follows:
  79.      cmp OPTIONS... FROM-FILE [TO-FILE]
  80.    The file name `-' is always the standard input.  `cmp' also uses the
  81. standard input if one file name is omitted.
  82.    An exit status of 0 means no differences were found, 1 means some
  83. differences were found, and 2 means trouble.
  84. * Menu:
  85. * cmp Options::        Summary of options to `cmp'.
  86. File: diff.info,  Node: cmp Options,  Up: Invoking cmp
  87. Options to `cmp'
  88. ================
  89.    Below is a summary of all of the options that GNU `cmp' accepts.
  90. Most options have two equivalent names, one of which is a single letter
  91. preceded by `-', and the other of which is a long name preceded by
  92. `--'.  Multiple single letter options (unless they take an argument)
  93. can be combined into a single command line word: `-cl' is equivalent to
  94. `-c -l'.
  95.      Print the differing characters.  Display control characters as a
  96.      `^' followed by a letter of the alphabet and precede characters
  97.      that have the high bit set with `M-' (which stands for "meta").
  98. `--ignore-initial=BYTES'
  99.      Ignore any differences in the the first BYTES bytes of the input
  100.      files.  Treat files with fewer than BYTES bytes as if they are
  101.      empty.
  102.      Print the (decimal) offsets and (octal) values of all differing
  103.      bytes.
  104. `--print-chars'
  105.      Print the differing characters.  Display control characters as a
  106.      `^' followed by a letter of the alphabet and precede characters
  107.      that have the high bit set with `M-' (which stands for "meta").
  108. `--quiet'
  109. `--silent'
  110.      Do not print anything; only return an exit status indicating
  111.      whether the files differ.
  112. `--verbose'
  113.      Print the (decimal) offsets and (octal) values of all differing
  114.      bytes.
  115. `--version'
  116.      Output the version number of `cmp'.
  117. File: diff.info,  Node: Invoking diff,  Next: Invoking diff3,  Prev: Invoking cmp,  Up: Top
  118. Invoking `diff'
  119. ***************
  120.    The format for running the `diff' command is:
  121.      diff OPTIONS... FROM-FILE TO-FILE
  122.    In the simplest case, `diff' compares the contents of the two files
  123. FROM-FILE and TO-FILE.  A file name of `-' stands for text read from
  124. the standard input.  As a special case, `diff - -' compares a copy of
  125. standard input to itself.
  126.    If FROM-FILE is a directory and TO-FILE is not, `diff' compares the
  127. file in FROM-FILE whose file name is that of TO-FILE, and vice versa.
  128. The non-directory file must not be `-'.
  129.    If both FROM-FILE and TO-FILE are directories, `diff' compares
  130. corresponding files in both directories, in alphabetical order; this
  131. comparison is not recursive unless the `-r' or `--recursive' option is
  132. given.  `diff' never compares the actual contents of a directory as if
  133. it were a file.  The file that is fully specified may not be standard
  134. input, because standard input is nameless and the notion of "file with
  135. the same name" does not apply.
  136.    `diff' options begin with `-', so normally FROM-FILE and TO-FILE may
  137. not begin with `-'.  However, `--' as an argument by itself treats the
  138. remaining arguments as file names even if they begin with `-'.
  139.    An exit status of 0 means no differences were found, 1 means some
  140. differences were found, and 2 means trouble.
  141. * Menu:
  142. * diff Options::    Summary of options to `diff'.
  143. File: diff.info,  Node: diff Options,  Up: Invoking diff
  144. Options to `diff'
  145. =================
  146.    Below is a summary of all of the options that GNU `diff' accepts.
  147. Most options have two equivalent names, one of which is a single letter
  148. preceded by `-', and the other of which is a long name preceded by
  149. `--'.  Multiple single letter options (unless they take an argument)
  150. can be combined into a single command line word: `-ac' is equivalent to
  151. `-a -c'.  Long named