hbase

heirloom base
git clone git://git.2f30.org/hbase
Log | Files | Refs | README

diff.1 (12820B)


      1 .\"
      2 .\" Copyright (c) 1980 Regents of the University of California.
      3 .\" All rights reserved.  The Berkeley software License Agreement
      4 .\" specifies the terms and conditions for redistribution.
      5 .\"
      6 .\"	from 4.3BSD diff.1	6.4 (Berkeley) 5/19/86
      7 .\"
      8 .\" This code contains changes by
      9 .\" Gunnar Ritter, Freiburg i. Br., Germany, March 2003. All rights reserved.
     10 .\"
     11 .\" Conditions 1, 2, and 4 and the no-warranty notice below apply
     12 .\" to these changes.
     13 .\"
     14 .\"
     15 .\" Copyright (c) 1980, 1993
     16 .\" 	The Regents of the University of California.  All rights reserved.
     17 .\"
     18 .\" Redistribution and use in source and binary forms, with or without
     19 .\" modification, are permitted provided that the following conditions
     20 .\" are met:
     21 .\" 1. Redistributions of source code must retain the above copyright
     22 .\"    notice, this list of conditions and the following disclaimer.
     23 .\" 2. Redistributions in binary form must reproduce the above copyright
     24 .\"    notice, this list of conditions and the following disclaimer in the
     25 .\"    documentation and/or other materials provided with the distribution.
     26 .\" 3. All advertising materials mentioning features or use of this software
     27 .\"    must display the following acknowedgement:
     28 .\" 	This product includes software developed by the University of
     29 .\" 	California, Berkeley and its contributors.
     30 .\" 4. Neither the name of the University nor the names of its contributors
     31 .\"    may be used to endorse or promote products derived from this software
     32 .\"    without specific prior written permission.
     33 .\"
     34 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     35 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     36 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     37 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     38 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     39 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     40 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     41 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     42 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     43 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     44 .\" SUCH DAMAGE.
     45 .\"
     46 .\"
     47 .\" Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
     48 .\"
     49 .\" Redistribution and use in source and binary forms, with or without
     50 .\" modification, are permitted provided that the following conditions
     51 .\" are met:
     52 .\"   Redistributions of source code and documentation must retain the
     53 .\"    above copyright notice, this list of conditions and the following
     54 .\"    disclaimer.
     55 .\"   Redistributions in binary form must reproduce the above copyright
     56 .\"    notice, this list of conditions and the following disclaimer in the
     57 .\"    documentation and/or other materials provided with the distribution.
     58 .\"   All advertising materials mentioning features or use of this software
     59 .\"    must display the following acknowledgement:
     60 .\"      This product includes software developed or owned by Caldera
     61 .\"      International, Inc.
     62 .\"   Neither the name of Caldera International, Inc. nor the names of
     63 .\"    other contributors may be used to endorse or promote products
     64 .\"    derived from this software without specific prior written permission.
     65 .\"
     66 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
     67 .\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
     68 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     69 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     70 .\" ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE
     71 .\" LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
     72 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     73 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     74 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     75 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     76 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     77 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     78 .\"
     79 .TH DIFF 1 "6/28/05" "Heirloom Toolchest" "User Commands"
     80 .SH NAME
     81 diff \- differential file comparator
     82 .SH SYNOPSIS
     83 .HP
     84 .nh
     85 .ad l
     86 \fBdiff\fR
     87 [\fB\-abBiptw\fR]
     88 [\fB\-cefhnu\fR]
     89 [\fB\-C\ \fInumber\fR]
     90 [\fB\-U\ \fInumber\fR]
     91 \fIfile1\fR \fIfile2\fR
     92 .HP
     93 .nh
     94 .ad l
     95 \fBdiff\fR
     96 [\fB\-abBiptw\fR]
     97 [\fB\-D\ \fIstring\fR]
     98 \fIfile1\fR \fIfile2\fR
     99 .HP
    100 .nh
    101 .ad l
    102 \fBdiff\fR
    103 [\fB\-abBiNptw12\fR]
    104 [\fB\-cefhnu\fR]
    105 [\fB\-C\ \fInumber\fR]
    106 [\fB\-U\ \fInumber\fR]
    107 [\fB\-lrs\fR]
    108 [\fB\-S\ \fIname\fR]
    109 [\fB\-x\ \fIpattern\fR]
    110 [\fB\-X\ \fIname\fR]
    111 \fIdirectory1\fR \fIdirectory2\fR
    112 .br
    113 .hy 1
    114 .SH DESCRIPTION
    115 .I Diff
    116 tells what lines must be changed in two files to bring them
    117 into agreement.
    118 If
    119 .I file1
    120 .RI ( file2 )
    121 is `\-', the standard input is used.
    122 If
    123 .I file1
    124 .RI ( file2 )
    125 is a directory, then a file in that directory
    126 whose file-name is the same as the file-name of
    127 .I file2
    128 .RI ( file1 )
    129 is used.
    130 The normal output contains lines of these forms:
    131 .IP "" 5
    132 .I n1
    133 a
    134 .I n3,n4
    135 .br
    136 .I n1,n2
    137 d
    138 .I n3
    139 .br
    140 .I n1,n2
    141 c
    142 .I n3,n4
    143 .PP
    144 These lines resemble
    145 .I ed
    146 commands to convert
    147 .I file1
    148 into
    149 .IR file2 .
    150 The numbers after the letters pertain to
    151 .IR file2 .
    152 In fact, by exchanging `a' for `d' and reading backward
    153 one may ascertain equally how to convert 
    154 .I file2
    155 into
    156 .IR file1 .
    157 As in 
    158 .I ed,
    159 identical pairs where
    160 .I n1
    161 =
    162 .I n2
    163 or
    164 .I n3
    165 =
    166 .I n4
    167 are abbreviated as a single number.
    168 .PP
    169 Following each of these lines come all the lines that are
    170 affected in the first file flagged by `<', 
    171 then all the lines that are affected in the second file
    172 flagged by `>'.
    173 .TP 10
    174 .B \-a
    175 causes a list of differences to be output
    176 for all files,
    177 even for those found to have binary content.
    178 This option is an extension.
    179 .TP 10
    180 .B \-b
    181 causes trailing whitespace characters
    182 to be ignored, and other
    183 strings of whitespace to compare equal.
    184 .TP 10
    185 .B \-i
    186 ignores the case of letters.  E.g., ``A'' will compare equal to ``a''.
    187 .TP 10
    188 .B \-p
    189 causes the name of the surrounding C function,
    190 or, more exactly,
    191 of the first previous unchanged line
    192 beginning with a letter, the dollar sign, or the underscore,
    193 to be output with each set of changes.
    194 Implies
    195 .I \-c
    196 unless
    197 .I \-u
    198 is also present.
    199 This option is an extension.
    200 .TP 10
    201 .B \-t
    202 will expand tabs in output lines.  Normal,
    203 .B \-c
    204 or
    205 .B \-u
    206 output adds character(s) to the front of each line which may screw up
    207 the indentation of the original source lines and make the output listing
    208 difficult to interpret.  This option will preserve the original source's
    209 indentation.
    210 .TP 10
    211 .B \-w
    212 is similar to
    213 .B \-b
    214 but causes whitespace characters
    215 to be totally ignored.
    216 E.g., ``if\ (\ a\ ==\ b\ )'' will compare equal to ``if(a==b)''.
    217 .TP 10
    218 .B \-B
    219 causes changes that consist entirely of empty lines added or deleted
    220 to be ignored.
    221 This option is an extension.
    222 .PP
    223 The following options are mutually exclusive:
    224 .TP 10
    225 .B \-c
    226 produces a diff with three lines of context.
    227 With
    228 .B \-c
    229 the output format is modified slightly:
    230 the output beginning with identification of the files involved and
    231 their creation dates and then each change is separated
    232 by a line with a dozen *'s.
    233 The lines removed from
    234 .I file1
    235 are marked with `\(mi '; those added to
    236 .I file2
    237 are marked `+ '.  Lines which are changed from one
    238 file to the other are marked in both files with with `! '.
    239 .\".sp
    240 .\"Changes which lie within <context> lines of each other are grouped
    241 .\"together on output.  (This is a change from the previous ``diff -c''
    242 .\"but the resulting output is usually much easier to interpret.)
    243 .TP 10
    244 \fB\-C\ \fInumber\fR
    245 Same as
    246 .B \-c
    247 but uses
    248 .I number
    249 of lines of context.
    250 .TP 10
    251 \fB\-D\ \fIstring\fR
    252 causes
    253 .I diff
    254 to create a merged version of
    255 .I file1
    256 and
    257 .I file2
    258 on the standard output, with C preprocessor controls included so that
    259 a compilation of the result without defining \fIstring\fR is equivalent
    260 to compiling
    261 .I file1,
    262 while defining
    263 .I string
    264 will yield
    265 .I file2.
    266 .TP 10
    267 .B \-e
    268 produces a script of
    269 .I "a, c"
    270 and 
    271 .I d
    272 commands for the editor
    273 .I ed,
    274 which will recreate
    275 .I file2
    276 from
    277 .IR file1 .
    278 In connection with
    279 .BR \-e ,
    280 the following shell program may help maintain
    281 multiple versions of a file.
    282 Only an ancestral file ($1) and a chain of 
    283 version-to-version
    284 .I ed
    285 scripts ($2,$3,...) made by
    286 .I diff
    287 need be on hand.
    288 A `latest version' appears on
    289 the standard output.
    290 .IP
    291 \ \ \ \ \ \ \ \ (shift; cat $*; echo \'1,$p\') \(bv ed \- $1
    292 .IP
    293 Extra commands are added to the output when comparing directories with
    294 .B \-e,
    295 so that the result is a
    296 .IR sh (1)
    297 script for converting text files which are common to the two directories
    298 from their state in
    299 .I dir1
    300 to their state in
    301 .I dir2.
    302 .TP 10
    303 .B \-f
    304 produces a script similar to that of
    305 .B \-e,
    306 not useful with
    307 .I ed,
    308 and in the opposite order.
    309 .TP 10
    310 .B \-h
    311 does a fast, half-hearted job.
    312 It works only when changed stretches are short
    313 and well separated,
    314 but does work on files of unlimited length.
    315 .TP 10
    316 .B \-n
    317 produces a script similar to that of
    318 .B \-e,
    319 but in the opposite order and with a count of changed lines on each
    320 insert or delete command.
    321 .\"This is the form used by
    322 .\".IR rcsdiff (1).
    323 .TP 10
    324 .B \-u
    325 produces a unified diff with three lines of context.
    326 The output begins with identification of the files involved
    327 and their creation dates,
    328 followed by the changes
    329 separated by `@@ \-range +range @@'.
    330 Lines removed from
    331 .I file1
    332 are marked with `\(mi',
    333 those added to
    334 .I file2
    335 are marked `+'.
    336 This option is an extension.
    337 .TP 10
    338 \fB\-U\ \fInumber\fR
    339 Same as
    340 .B \-u
    341 but uses
    342 .I number
    343 of lines of context.
    344 This option is an extension.
    345 .PP
    346 If both arguments are directories,
    347 .I diff
    348 sorts the contents of the directories by name, and then runs the
    349 regular file
    350 .I diff
    351 algorithm on text files which are different.
    352 Binary files which differ,
    353 common subdirectories, and files which appear in only one directory
    354 are listed.
    355 .PP
    356 Options when comparing directories are:
    357 .TP 10
    358 .B \-l
    359 long output format; each text file
    360 .I diff
    361 is piped through
    362 .IR pr (1)
    363 to paginate it,
    364 other differences are remembered and summarized
    365 after all text file differences are reported.
    366 .TP 10
    367 .B \-N
    368 causes the text of files
    369 that exist in one directory only
    370 to be output
    371 as if compared to an empty file modified at 1/1/70.
    372 This option is an extension.
    373 .TP 10
    374 .B \-1
    375 is similar to
    376 .IR \-N ,
    377 but causes just the text of files that exist in
    378 .I directory1
    379 only to be output.
    380 Files that exist only in
    381 .I directory2
    382 are listed.
    383 This option is an extension.
    384 .TP 10
    385 .B \-2
    386 is similar to
    387 .IR \-N ,
    388 but causes just the text of files that exist in
    389 .I directory2
    390 only to be output.
    391 Files that exist only in
    392 .I directory1
    393 are listed.
    394 This option is an extension.
    395 .TP 10
    396 .B \-r
    397 causes application of
    398 .I diff
    399 recursively to common subdirectories encountered.
    400 .TP 10
    401 .B \-s
    402 causes 
    403 .I diff
    404 to report files which are the same, which are otherwise not mentioned.
    405 .TP 10
    406 .BI \-S " name"
    407 starts a directory
    408 .I diff
    409 in the middle beginning with file
    410 .I name.
    411 .TP 10
    412 .BI \-x " pattern"
    413 excludes all file names that match
    414 .I pattern
    415 (as described in
    416 .IR glob (7))
    417 from comparison.
    418 If
    419 .I pattern
    420 matches a directory,
    421 files below that directory are also excluded.
    422 This option is an extension.
    423 .TP 10
    424 .BI \-X " name"
    425 excludes all file names contained in
    426 .IR name .
    427 This option is an extension.
    428 .SH "ENVIRONMENT VARIABLES"
    429 .TP
    430 .BR LANG ", " LC_ALL
    431 See
    432 .IR locale(7).
    433 .TP
    434 .B LC_CTYPE
    435 Sets the mapping of bytes to characters,
    436 character case translation
    437 and the set of whitespace characters.
    438 .TP
    439 .B SYSV3
    440 If this variable is set,
    441 invalid options are ignored instead of being rejected,
    442 and the text of some diagnostic messages is changed.
    443 .SH FILES
    444 .ta \w'/usr/5lib/diffh   'u
    445 /tmp/d?????
    446 .br
    447 /usr/5lib/diffh	for \fB\-h\fR
    448 .br
    449 diff	for directory diffs
    450 .br
    451 pr
    452 .SH "SEE ALSO"
    453 bdiff(1),
    454 cmp(1),
    455 cc(1),
    456 comm(1),
    457 ed(1),
    458 diff3(1),
    459 patch(1),
    460 locale(7)
    461 .SH DIAGNOSTICS
    462 Exit status is 0 for no differences, 1 for some, 2 for trouble.
    463 .SH NOTES
    464 Editing scripts produced under the
    465 .BR \-e " or"
    466 .BR \-f " option are naive about"
    467 creating lines consisting of a single `\fB.\fR'.
    468 .PP
    469 When comparing directories with the
    470 \fB\-b, \-w\fP, or \fB\-i\fP
    471 options specified,
    472 .I diff
    473 first compares the files ala
    474 .I cmp,
    475 and then decides to run the
    476 .I diff
    477 algorithm if they are not equal.
    478 This may cause a small amount of spurious output if the files
    479 then turn out to be identical because the only differences are
    480 insignificant blank string or case differences.
    481 .PP
    482 When
    483 .I diff
    484 output is used with
    485 .IR ed (1)
    486 or
    487 .IR patch (1)
    488 for file synchronization,
    489 it is recommended that it is run in the
    490 .I C
    491 or another single-byte LC_CTYPE locale
    492 since character-to-byte conversion
    493 might otherwise hide some changes.