home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / DIFFPT.ZIP / DIFF.MAN < prev    next >
Text File  |  1991-07-01  |  11KB  |  263 lines

  1. NAME
  2.      gdiff - differential file and directory comparator (Berkeley
  3.      Version)
  4.  
  5. SYNOPSIS
  6.      gdiff [[ -lNrs ] [ -aBcefHhnpT ] [ -C cnt ] [ -FI regexp ] [
  7.      -biwt ]] ...  dir1 dir2
  8.      gdiff [[ -cefhn ] [ -biwt ]] ...  file1 file2
  9.  
  10. DESCRIPTION
  11.      If both arguments are directories, gdiff sorts the contents
  12.      of the directories by name, and then runs the regular file
  13.      gdiff algorithm (described below) on text files which are
  14.      different.  Binary files which differ, common subdirec-
  15.      tories, and files which appear in only one directory are
  16.      listed.  Options when comparing directories are:
  17.  
  18.      -l   long output format; each text file diff is piped
  19.           through pr(1) to paginate it, other differences are
  20.           remembered and summarized after all text file differ-
  21.           ences are reported.
  22.  
  23.      -r   causes application of gdiff recursively to common sub-
  24.           directories encountered.
  25.  
  26.      -s   causes gdiff to report files which are the same, which
  27.           are otherwise not mentioned.
  28.  
  29.      -Sname
  30.           starts a directory gdiff in the middle beginning with
  31.           file name.
  32.  
  33.      When run on regular files, and when comparing text files
  34.      which differ during directory comparison, gdiff tells what
  35.      lines must be changed in the files to bring them into agree-
  36.      ment.  Except in rare circumstances, gdiff finds a smallest
  37.      sufficient set of file differences.  If neither file1 nor
  38.      file2 is a directory, then either may be given as `-', in
  39.      which case the standard input is used.  If file1 is a direc-
  40.      tory, then a file in that directory whose file-name is the
  41.      same as the file-name of file2 is used (and vice versa).
  42.  
  43.      There are several options for output format; the default
  44.      output format contains lines of these forms:
  45.  
  46.           n1 a n3,n4
  47.           n1,n2 d n3
  48.           n1,n2 c n3,n4
  49.  
  50.      These lines resemble ed commands to convert file1 into
  51.      file2.  The numbers after the letters pertain to file2.  In
  52.      fact, by exchanging `a' for `d' and reading backward one may
  53.      ascertain equally how to convert file2 into file1.  As in
  54.      ed, identical pairs where n1 = n2 or n3 = n4 are abbreviated
  55.      as a single number.
  56.  
  57.      Following each of these lines come all the lines that are
  58.      affected in the first file flagged by `<', then all the
  59.      lines that are affected in the second file flagged by `>'.
  60.  
  61.      Except for -b, -w, -i or -t which may be given with any of
  62.      the others, the following options are mutually exclusive:
  63.  
  64.      -e       produces a script of a, c and d commands for the
  65.               editor ed, which will recreate file2 from file1.
  66.               In connection with -e, the following shell program
  67.               may help maintain multiple versions of a file.
  68.               Only an ancestral file ($1) and a chain of
  69.               version-to-version ed scripts ($2,$3,...) made by
  70.               gdiff need be on hand.  A `latest version' appears
  71.               on the standard output.
  72.  
  73.                       (shift; cat $*; echo '1,$p') | ed - $1
  74.  
  75.               Extra commands are added to the output when compar-
  76.               ing directories with -e, so that the result is a
  77.               sh(1) script for converting text files which are
  78.               common to the two directories from their state in
  79.               dir1 to their state in dir2.
  80.  
  81.      -f       produces a script similar to that of -e, not useful
  82.               with ed, and in the opposite order.
  83.  
  84.      -n       produces a script similar to that of -e, but in the
  85.               opposite order and with a count of changed lines on
  86.               each insert or delete command.  This is the form
  87.               used by rcsdiff(1d).
  88.  
  89.      -c       produces a diff with lines of context.  The default
  90.               is to present 3 lines of context and may be
  91.               changed, e.g to 10, by -c10.  With -c the output
  92.               format is modified slightly: the output beginning
  93.               with identification of the files involved and their
  94.               creation dates and then each change is separated by
  95.               a line with a dozen *'s.  The lines removed from
  96.               file1 are marked with `- '; those added to file2
  97.               are marked `+ '.  Lines which are changed from one
  98.               file to the other are marked in both files with
  99.               with `! '.
  100.  
  101.               Changes which lie within <context> lines of each
  102.               other are grouped together on output.  (This is a
  103.               change from the previous ``diff -c'' but the
  104.               resulting output is usually much easier to inter-
  105.               pret.)
  106.  
  107.      -h       does a fast, half-hearted job.  It works only when
  108.               changed stretches are short and well separated, but
  109.               does work on files of unlimited length.
  110.  
  111.      -b       causes trailing blanks (spaces and tabs) to be
  112.               ignored, and other strings of blanks to compare
  113.               equal.
  114.  
  115.      -w       is similar to -b but causes whitespace (blanks and
  116.               tabs) to be totally ignored.  E.g.,
  117.               ``if ( a == b )'' will compare equal to
  118.               ``if(a==b)''.
  119.  
  120.      -i       ignores the case of letters.  E.g., ``A'' will com-
  121.               pare equal to ``a''.
  122.  
  123.      -t       will expand tabs in output lines.  Normal or -c
  124.               output adds character(s) to the front of each line
  125.               which may screw up the indentation of the original
  126.               source lines and make the output listing difficult
  127.               to interpret.  This option will preserve the origi-
  128.               nal source's indentation.
  129.  
  130. FILES
  131.      /tmp/d?????
  132.      /usr/local/dist/gdiff for directory diffs
  133.      /bin/pr
  134.  
  135. SEE ALSO
  136.      cmp(1), cc(1), comm(1), ed(1), gdiff3(1d)
  137.  
  138. DIAGNOSTICS
  139.      Exit status is 0 for no differences, 1 for some, 2 for trou-
  140.      ble.
  141.  
  142. BUGS
  143.      Editing scripts produced under the -e or -f option are naive
  144.      about creating lines consisting of a single `.'.
  145.  
  146.      When comparing directories with the -b, -w or -i options
  147.      specified, diff first compares the files ala cmp, and then
  148.      decides to run the diff algorithm if they are not equal.
  149.      This may cause a small amount of spurious output if the
  150.      files then turn out to be identical because the only differ-
  151.      ences are insignificant blank string or case differences.
  152.  
  153. --------------------
  154.  
  155. NAME
  156.      diff - GNU diff, display line-by-line differences between
  157.      files, including binary files
  158.  
  159. SYNOPSIS
  160.      diff [ options ] filename1 filename2
  161.      diff [ options ] directory1 directory2
  162.  
  163. WARNING
  164.      This manual page is updated only occasionally, because the
  165.      GNU project does not use nroff.
  166.  
  167. DESCRIPTION
  168.      This version of diff provides all the features of BSD's
  169.      diff.  It has the following additional features.
  170.  
  171.      An input file may end in a non-newline character.  If so,
  172.      its last line is called an incomplete line and is dis-
  173.      tinguished on output from a full line.  In the default, -c,
  174.      and -u output styles, an incomplete output line is followed
  175.      by a diagnostic line that starts with \.  With -n, an incom-
  176.      plete line is output without a trailing newline.  Other out-
  177.      put styles (-D, -e, -f) cannot represent an incomplete line,
  178.      so they pretend that there was a newline, and -e and -f also
  179.      print an error message.
  180.  
  181.      For example, suppose F and G are one-byte files that contain
  182.      just `f' and `g', respectively.  Then `diff F G' outputs
  183.  
  184.           1c1
  185.           < f
  186.           \ No newline at end of file
  187.           ---
  188.           > g
  189.           \ No newline at end of file
  190.  
  191.      (The exact diagnostic message may differ, e.g. for non-
  192.      English locales.) `diff -n F G' outputs the following
  193.      without a trailing newline:
  194.  
  195.           d1 1
  196.           a1 1
  197.           g
  198.  
  199.      `diff -e F G' sends two diagnostics to standard error and
  200.      the following to standard output:
  201.  
  202.           1c
  203.           g
  204.           .
  205.  
  206.      A file is considered to be text if its first characters are
  207.      all in the ISO 8859 character set; BSD's diff uses ASCII.
  208.  
  209. OPTIONS
  210.      GNU diff has the following additional options:
  211.  
  212.      -a             Always treat files as text and compare them
  213.                     line-by-line, even if they do not appear to
  214.                     be text.
  215.  
  216.      -B             Ignore changes that just insert or delete
  217.                     blank lines.
  218.  
  219.      -C #           Request -c format and specify number of con-
  220.                     text lines.
  221.  
  222.      -F regexp      In context format, for each unit of differ-
  223.                     ences, show some of the last preceding line
  224.                     that matches the specified regexp.
  225.  
  226.      -H             Use heuristics to speed handling of large
  227.                     files that have numerous scattered small
  228.                     changes.  The algorithm becomes asymptoti-
  229.                     cally linear for such files!
  230.  
  231.      -I regexp      Ignore changes that just insert or delete
  232.                     lines that match the specified regexp.
  233.  
  234.      -L label       Use the specified label in file header lines
  235.                     output by the -c option.  This option may be
  236.                     given zero, one, or two times, to affect nei-
  237.                     ther label, just the first file's label, or
  238.                     both labels.  A file's default label is its
  239.                     name, a tab, and its modification date.
  240.  
  241.      -N             In directory comparison, if a file is found
  242.                     in only one directory, treat it as present
  243.                     but empty in the other directory.
  244.  
  245.      -p             equivalent to -c -F'^[_a-zA-Z]'.  This is
  246.                     useful for C code because it shows which
  247.                     function each change is in.
  248.  
  249.      -T             Print a tab rather than a space before the
  250.                     text of a line in normal or context format.
  251.                     This causes the alignment of tabs in the line
  252.                     to look normal.
  253.  
  254.      -u [#]         Produce unified style output with # context
  255.                     lines (default 3).  This style is like -c,
  256.                     but it is more compact because context lines
  257.                     are printed only once.  Lines from just the
  258.                     first file are marked '-'; lines from just
  259.                     the second file are marked '+'.
  260.  
  261. SEE ALSO
  262.      diff3(1)
  263.