home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / info / wdiff.info < prev   
Encoding:
GNU Info File  |  1996-10-12  |  13.8 KB  |  355 lines

  1. This is Info file wdiff.info, produced by Makeinfo-1.64 from the input
  2. file /ade-src/fsf/wdiff/wdiff.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * wdiff: (wdiff).       Word difference finder.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This file documents the `wdiff' command, which compares two files,
  9. finding which words have been deleted or added to the first for getting
  10. the second.
  11.  
  12.    Copyright (C) 1992, 1994 Free Software Foundation, Inc.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided that
  20. the entire resulting derived work is distributed under the terms of a
  21. permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Foundation.
  27.  
  28. 
  29. File: wdiff.info,  Node: Top,  Next: Overview,  Prev: (dir),  Up: (dir)
  30.  
  31. GNU `wdiff'
  32. ***********
  33.  
  34.    `wdiff' is a front-end to GNU `diff'.  It compares two files,
  35. finding which words have been deleted or added to the first in order to
  36. create the second.  It has many output formats and interacts well with
  37. terminals and pagers (notably with `less').  `wdiff' is particularily
  38. useful when two texts differ only by a few words and paragraphs have
  39. been refilled.
  40.  
  41.    This is release 0.5.
  42.  
  43. * Menu:
  44.  
  45. * Overview::                    Preliminary information.
  46. * Invoking wdiff::              How to run `wdiff'.
  47. * Examples::                    Actual examples of `wdiff' usage.
  48.  
  49. 
  50. File: wdiff.info,  Node: Overview,  Next: Invoking wdiff,  Prev: Top,  Up: Top
  51.  
  52. Overview
  53. ********
  54.  
  55.    The program `wdiff' is a front end to `diff' for comparing files on
  56. a word per word basis.  A word is anything between whitespace.  This is
  57. useful for comparing two texts in which a few words have been changed
  58. and for which paragraphs have been refilled.  It works by creating two
  59. temporary files, one word per line, and then executes `diff' on these
  60. files.  It collects the `diff' output and uses it to produce a nicer
  61. display of word differences between the original files.
  62.  
  63.    Ideally, `wdiff' should avoid calling `diff' and do all the work
  64. internally, allowing it to be faster and more polished.  However, I
  65. loathe replicating the `diff' algorithm and development effort, instead
  66. of improving `diff' itself.  It would be more sensible to integrate
  67. `wdiff' into `diff' than the other way around.  I did it this way only
  68. because I had a sudden and urgent need for it, and it would have taken
  69. too much time to integrate it correctly into GNU `diff'.  Your advice
  70. or opinions about this are welcome.
  71.  
  72.    `wdiff' was written by Franc,ois Pinard.  Please report bugs to
  73. `bug-gnu-utils@prep.ai.mit.edu'.  Include the version number, which you
  74. can find by running `wdiff --version'.  Include in your message
  75. sufficient input to reproduce the problem and also, the output you
  76. expected.
  77.  
  78. 
  79. File: wdiff.info,  Node: Invoking wdiff,  Next: Examples,  Prev: Overview,  Up: Top
  80.  
  81. Invoking `wdiff'
  82. ****************
  83.  
  84.    The format for running the `wdiff' program is:
  85.  
  86.      wdiff OPTION ... OLD_FILE NEW_FILE
  87.  
  88.    `wdiff' compares files OLD_FILE and NEW_FILE and produces an
  89. annotated copy of NEW_FILE on standard output.  The empty string or the
  90. string `-' denotes standard input, but standard input cannot be used
  91. twice in the same invocation.  The complete path of a file should be
  92. given, a directory name is not accepted.  `wdiff' will exit with a
  93. status of 0 if no differences were found, a status of 1 if any
  94. differences were found, or a status of 2 for any error.
  95.  
  96.    In this documentation, "deleted text" refers to text in OLD_FILE
  97. which is not in NEW_FILE, while "inserted text" refers to text on
  98. NEW_FILE which is not in OLD_FILE.
  99.  
  100.    `wdiff' supports the following command line options:
  101.  
  102. `--help'
  103. `-h'
  104.      Print an informative help message describing the options.
  105.  
  106. `--version'
  107. `-v'
  108.      Print the version number of `wdiff' on the standard error output.
  109.  
  110. `--no-deleted'
  111. `-1'
  112.      Avoid producing deleted words on the output.  If neither `-1' or
  113.      `-2' is selected, the original right margin may be exceeded for
  114.      some lines.
  115.  
  116. `--no-inserted'
  117. `-2'
  118.      Avoid producing inserted words on the output.  When this flag is
  119.      given, the whitespace in the output is taken from OLD_FILE instead
  120.      of NEW_FILE.  If neither `-1' or `-2' is selected, the original
  121.      right margin may be exceeded for some lines.
  122.  
  123. `--no-common'
  124. `-3'
  125.      Avoid producing common words on the output.  When this option is
  126.      not selected, common words and whitespace are taken from NEW_FILE,
  127.      unless option `-2' is given, in which case common words and
  128.      whitespace are rather taken from OLD_FILE.  When selected,
  129.      differences are separated from one another by lines of dashes.
  130.      Moreover, if this option is selected at the same time as `-1' or
  131.      `-2', then none of the output will have any emphasis, i.e. no bold
  132.      or underlining.  Finally, if this option is not selected, but both
  133.      `-1' and `-2' are, then sections of common words between
  134.      differences are segregated by lines of dashes.
  135.  
  136. `--ignore-case'
  137. `-c'
  138.      Do not consider case difference while comparing words.  Each lower
  139.      case letter is seen as identical to its upper case equivalent for
  140.      the purpose of deciding if two words are the same.
  141.  
  142. `--statistics'
  143. `-s'
  144.      On completion, for each file, the total number of words, the
  145.      number of common words between the files, the number of words
  146.      deleted or inserted and the number of words that have changed is
  147.      output.  (A changed word is one that has been replaced or is part
  148.      of a replacement.)  Except for the total number of words, all of
  149.      the numbers are followed by a percentage relative to the total
  150.      number of words in the file.
  151.  
  152. `--auto-pager'
  153. `-a'
  154.      Some initiatives which were previously automatically taken in
  155.      previous versions of `wdiff' are now put under the control of this
  156.      option.  By using it, a pager is interposed whenever the `wdiff'
  157.      output is directed to the user's terminal.  Without this option,
  158.      no pager will be called, the user is then responsible for
  159.      explicitly piping `wdiff' output into a pager, if required.
  160.  
  161.      The pager is selected by the value of the `PAGER' environment
  162.      variable when `wdiff' is run.  If `PAGER' is not defined at run
  163.      time, then a default pager, selected at installation time, will be
  164.      used instead.  A defined but empty value of `PAGER' means no pager
  165.      at all.
  166.  
  167.      When a pager is interposed through the use of this option, one of
  168.      the options `-l' or `-t' is also selected, depending on whether
  169.      the string `less' appears in the pager's name or not.
  170.  
  171.      It is often useful to define `wdiff' as an alias for `wdiff -a'.
  172.      However, this *hides* the normal `wdiff' behaviour.  The default
  173.      behaviour may be restored simply by piping the output from `wdiff'
  174.      through `cat'.  This dissociates the output from the user's
  175.      terminal.
  176.  
  177. `--printer'
  178. `-p'
  179.      Use over-striking to emphasize parts of the output.  Each
  180.      character of the deleted text is underlined by writing an
  181.      underscore `_' first, then a backspace and then the letter to be
  182.      underlined.  Each character of the inserted text is emboldened by
  183.      writing it twice, with a backspace in between.  This option is not
  184.      selected by default.
  185.  
  186. `--less-mode'
  187. `-l'
  188.      Use over-striking to emphasize parts of output.  This option works
  189.      as option `-p', but also over-strikes whitespace associated with
  190.      inserted text.  `less' shows such whitespace using reverse video.
  191.      This option is not selected by default.  However, it is
  192.      automatically turned on whenever `wdiff' launches the pager
  193.      `less'.  See option `-a'.
  194.  
  195.      This option is commonly used in conjunction with `less':
  196.  
  197.           wdiff -l OLD_FILE NEW_FILE | less
  198.  
  199. `--terminal'
  200. `-t'
  201.      Force the production of `termcap' strings for emphasising parts of
  202.      output, even if the standard output is not associated with a
  203.      terminal.  The `TERM' environment variable must contain the name
  204.      of a valid `termcap' entry.  If the terminal description permits,
  205.      underlining is used for marking deleted text, while bold or
  206.      reverse video is used for marking inserted text.  This option is
  207.      not selected by default.  However, it is automatically turned on
  208.      whenever `wdiff' launches a pager, and it is known that the pager
  209.      is *not* `less'.  See option `-a'.
  210.  
  211.      This option is commonly used when `wdiff' output is not redirected,
  212.      but sent directly to the user terminal, as in:
  213.  
  214.           wdiff -t OLD_FILE NEW_FILE
  215.  
  216.      A common kludge uses `wdiff' together with the pager `more', as in:
  217.  
  218.           wdiff -t OLD_FILE NEW_FILE | more
  219.  
  220.      However, some versions of `more' use `termcap' emphasis for their
  221.      own purposes, so strange interactions are possible.
  222.  
  223. `--start-delete ARGUMENT'
  224. `-w ARGUMENT'
  225.      Use ARGUMENT as the "start delete" string.  This string will be
  226.      output prior to any sequence of deleted text, to mark where it
  227.      starts.  By default, no start delete string is used unless there
  228.      is no other means of distinguishing where such text starts; in
  229.      this case the default start delete string is `[-'.
  230.  
  231. `--end-delete ARGUMENT'
  232. `-x ARGUMENT'
  233.      Use ARGUMENT as the "end delete" string.  This string will be
  234.      output after any sequence of deleted text, to mark where it ends.
  235.      By default, no end delete string is used unless there is no other
  236.      means of distinguishing where such text ends; in this case the
  237.      default end delete string is `-]'.
  238.  
  239. `--start-insert ARGUMENT'
  240. `-y ARGUMENT'
  241.      Use ARGUMENT as the "start insert" string.  This string will be
  242.      output prior to any sequence of inserted text, to mark where it
  243.      starts.  By default, no start insert string is used unless there
  244.      is no other means of distinguishing where such text starts; in
  245.      this case the default start insert string is `{+'.
  246.  
  247. `--end-insert ARGUMENT'
  248. `-z ARGUMENT'
  249.      Use ARGUMENT as the "end insert" string.  This string will be
  250.      output after any sequence of inserted text, to mark where it ends.
  251.      By default, no end insert string is used unless there is no other
  252.      means of distinguishing where such text ends; in this case the
  253.      default end insert string is `+}'.
  254.  
  255. `--avoid-wraps'
  256. `-n'
  257.      Avoid spanning the end of line while showing deleted or inserted
  258.      text.  Any single fragment of deleted or inserted text spanning
  259.      many lines will be considered as being made up of many smaller
  260.      fragments not containing a newline.  So deleted text, for example,
  261.      will have an end delete string at the end of each line, just
  262.      before the new line, and a start delete string at the beginning of
  263.      the next line.  A long paragraph of inserted text will have each
  264.      line bracketed between start insert and end insert strings.  This
  265.      behaviour is not selected by default.
  266.  
  267.    Note that options `-p', `-t', and `-[wxyz]' are not mutually
  268. exclusive.  If you use a combination of them, you will merely
  269. accumulate the effect of each.  Option `-l' is a variant of option `-p'.
  270.  
  271. 
  272. File: wdiff.info,  Node: Examples,  Prev: Invoking wdiff,  Up: Top
  273.  
  274. Actual examples of `wdiff' usage
  275. ********************************
  276.  
  277.    This section presents a few examples of usage, most of them have been
  278. contributed by `wdiff' users.
  279.  
  280.    * Change bars example.
  281.  
  282.      This example comes from a discussion with Joe Wells,
  283.      `jbw@cs.bu.edu'.
  284.  
  285.      The following command produces a copy of NEW_FILE, shifted right
  286.      one space to accommodate change bars since the last revision,
  287.      ignoring those changes coming only from paragraph refilling.  Any
  288.      line with new or changed text will get a `|' in column 1.
  289.      However, deleted text is not shown nor marked.
  290.  
  291.           wdiff -1n OLD_FILE NEW_FILE |
  292.             sed -e 's/^/  /;/{+/s/^ /|/;s/{+//g;s/+}//g'
  293.  
  294.      Here is how it works.  Word differences are found, paying
  295.      attention only to additions, as requested by option `-1'.  For
  296.      bigger changes which span line boundaries, the insert bracket
  297.      strings are repeated on each output line, as requested by option
  298.      `-n'.  This output is then reformatted with a `sed' script which
  299.      shifts the text right two columns, turns the initial space into a
  300.      bar only if there is some new text on that line, then removes all
  301.      insert bracket strings.
  302.  
  303.    * `LaTeX' example.
  304.  
  305.      This example has been provided by Steve Fisk,
  306.      `fisk@polar.bowdoin.edu'.
  307.  
  308.      The following uses LaTeX to put deleted text in boxes, and new text
  309.      in double boxes:
  310.  
  311.           wdiff -w "\fbox{" -x "}" -y "\fbox{\fbox{" -z "}}" ...
  312.  
  313.      works nicely.
  314.  
  315.    * `troff' example.
  316.  
  317.      This example comes from Paul Fox, `pgf@cayman.com'.
  318.  
  319.      Using `wdiff', with some `troff'-specific delimiters gives *much*
  320.      better output.  The delimiters I used:
  321.  
  322.           wdiff -w'\s-5' -x'\s0' -y'\fB' -z'\fP' ...
  323.  
  324.      This makes the pointsize of deletions 5 points smaller than
  325.      normal, and emboldens insertions.  Fantastic!
  326.  
  327.      I experimented with:
  328.  
  329.           wdiff -w'\fI' -x'\fP' -y'\fB' -z'\fP'
  330.  
  331.      since that's more like the defaults you use for
  332.      terminals/printers, but since I actually use italics for emphasis
  333.      in my documents, I thought the point size thing was clearer.
  334.  
  335.      I tried it on code, and it works surprisingly well there, too...
  336.  
  337.      Marty Leisner `leisner@eso.mc.xerox.com' says:
  338.  
  339.      In the previous example, you had smaller text being taken out and
  340.      bold face inserted.  I had smaller text being taken out and larger
  341.      text being inserted, I'm using bold face for other things, so this
  342.      is more clear.
  343.  
  344.           wdiff -w '\s-3' -x'\s0' -y'\s+3' -z'\s0'
  345.  
  346.  
  347. 
  348. Tag Table:
  349. Node: Top1072
  350. Node: Overview1745
  351. Node: Invoking wdiff3132
  352. Node: Examples11439
  353. 
  354. End Tag Table
  355.