BSD 4_4 release
[unix-history] / usr / src / usr.bin / diff / diff / diff.1
index e570bcf..1b5c078 100644 (file)
@@ -1,23 +1,37 @@
-.\" Copyright (c) 1980, 1990 The Regents of the University of California.
-.\" All rights reserved.
+.\" Copyright (c) 1980, 1990, 1993
+.\"    The Regents of the University of California.  All rights reserved.
 .\"
 .\"
-.\" Redistribution and use in source and binary forms are permitted provided
-.\" that: (1) source distributions retain this entire copyright notice and
-.\" comment, and (2) distributions including binaries display the following
-.\" acknowledgement:  ``This product includes software developed by the
-.\" University of California, Berkeley and its contributors'' in the
-.\" documentation or other materials provided with the distribution and in
-.\" all advertising materials mentioning features or use of this software.
-.\" Neither the name of the University nor the names of its contributors may
-.\" be used to endorse or promote products derived from this software without
-.\" specific prior written permission.
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by the University of
+.\"    California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
 .\"
 .\"
-.\"     @(#)diff.1     6.6 (Berkeley) 7/24/90
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
 .\"
 .\"
-.Dd July 24, 1990
+.\"     @(#)diff.1     8.1 (Berkeley) 6/30/93
+.\"
+.Dd June 30, 1993
 .Dt DIFF 1
 .Os BSD 4
 .Sh NAME
 .Dt DIFF 1
 .Os BSD 4
 .Sh NAME
@@ -29,7 +43,7 @@
 .Op Fl biwt
 .Ar file1 file2
 .Nm diff
 .Op Fl biwt
 .Ar file1 file2
 .Nm diff
-.Op Fl D Ar string
+.Op Fl D Ns Ar string
 .Op Fl biw
 .Ar file1 file2
 .Nm diff
 .Op Fl biw
 .Ar file1 file2
 .Nm diff
@@ -38,6 +52,7 @@
 .Op Fl s
 .Op Fl cefhn
 .Op Fl biwt
 .Op Fl s
 .Op Fl cefhn
 .Op Fl biwt
+.Op Fl S Ns Ar name
 .Ar dir1 dir2
 .Sh DESCRIPTION
 The
 .Ar dir1 dir2
 .Sh DESCRIPTION
 The
@@ -51,10 +66,10 @@ convert one file into the other.
 No output is produced if the files are identical.
 .Pp
 Output options (mutually exclusive):
 No output is produced if the files are identical.
 .Pp
 Output options (mutually exclusive):
-.Tw Fl
-.Tp Fl c
+.Bl -tag -width Ds
+.It Fl c
 produces a diff with lines of context.
 produces a diff with lines of context.
-The default is to present 3 lines of context and may be changed, e.g to 10, by
+The default is to present 3 lines of context and may be changed, e.g., to 10, by
 .Fl c10 .
 With
 .Fl c
 .Fl c10 .
 With
 .Fl c
@@ -67,11 +82,11 @@ The lines removed from
 are marked with `\(mi '; those added to
 .Ar file2
 are marked `+ '.  Lines which are changed from one
 are marked with `\(mi '; those added to
 .Ar file2
 are marked `+ '.  Lines which are changed from one
-file to the other are marked in both files with with `! '.
+file to the other are marked in both files with `! '.
 Changes which lie within <context> lines of each other are grouped
 together on output.  (This is a change from the previous ``diff -c''
 but the resulting output is usually much easier to interpret.)
 Changes which lie within <context> lines of each other are grouped
 together on output.  (This is a change from the previous ``diff -c''
 but the resulting output is usually much easier to interpret.)
-.Tp Fl e
+.It Fl e
 produces output in a form suitable as input for the editor utility,
 .Xr ed 1 ,
 which can then be used to convert file1 into file2.
 produces output in a form suitable as input for the editor utility,
 .Xr ed 1 ,
 which can then be used to convert file1 into file2.
@@ -85,26 +100,24 @@ from their state in
 .Ar dir1
 to their state in
 .Ar dir2 .
 .Ar dir1
 to their state in
 .Ar dir2 .
-.Tp Fl f
-identical output of the
+.It Fl f
+identical output to that of the
 .Fl e
 flag, but in reverse order.  It cannot
 be digested by
 .Xr ed 1 .
 .Fl e
 flag, but in reverse order.  It cannot
 be digested by
 .Xr ed 1 .
-.Tp Fl h
+.It Fl h
 Invokes an alternate algorithm which can handle files of very long lengths.
 There is a trade off. The algorithm can only deal with changes which are
 clearly delimited and brief. Long sections of changes and overlaps will
 confuse it.
 Invokes an alternate algorithm which can handle files of very long lengths.
 There is a trade off. The algorithm can only deal with changes which are
 clearly delimited and brief. Long sections of changes and overlaps will
 confuse it.
-.Tp Fl n
+.It Fl n
 produces a script similar to that of
 .Fl e ,
 but in the opposite order and with a count of changed lines on each
 insert or delete command.  This is the form used by
 .Xr rcsdiff  1  .
 produces a script similar to that of
 .Fl e ,
 but in the opposite order and with a count of changed lines on each
 insert or delete command.  This is the form used by
 .Xr rcsdiff  1  .
-.Tc Fl D
-.Ar string
-.Cx
+.It Fl D Ns Ar string
 creates a merged version of
 .Ar file1
 and
 creates a merged version of
 .Ar file1
 and
@@ -119,54 +132,53 @@ while defining
 .Ar string
 will yield
 .Ar file2 .
 .Ar string
 will yield
 .Ar file2 .
-.Tp
+.El
 .Pp
 Comparison options:
 .Pp
 Comparison options:
-.Tp Fl b
+.Bl -tag -width Ds
+.It Fl b
 causes trailing blanks (spaces and tabs) to be ignored, and other
 strings of blanks to compare equal.
 causes trailing blanks (spaces and tabs) to be ignored, and other
 strings of blanks to compare equal.
-.Tp Fl i
+.It Fl i
 ignores the case of letters.  E.g., ``A'' will compare equal to ``a''.
 ignores the case of letters.  E.g., ``A'' will compare equal to ``a''.
-.Tp Fl t
+.It Fl t
 will expand tabs in output lines.  Normal or
 .Fl c
 output adds character(s) to the front of each line which may screw up
 the indentation of the original source lines and make the output listing
 difficult to interpret.  This option will preserve the original source's
 indentation.
 will expand tabs in output lines.  Normal or
 .Fl c
 output adds character(s) to the front of each line which may screw up
 the indentation of the original source lines and make the output listing
 difficult to interpret.  This option will preserve the original source's
 indentation.
-.Tp Fl w
+.It Fl w
 is similar to
 .Fl b
 but causes whitespace (blanks and tabs) to be totally ignored.  E.g.,
 ``if\ (\ a\ ==\ b\ )'' will compare equal to ``if(a==b)''.
 is similar to
 .Fl b
 but causes whitespace (blanks and tabs) to be totally ignored.  E.g.,
 ``if\ (\ a\ ==\ b\ )'' will compare equal to ``if(a==b)''.
-.Tp
+.El
 .Pp
 Directory comparison options:
 .Pp
 Directory comparison options:
-.Tw Fl
-.Tp Fl l
+.Bl -tag -width Ds
+.It Fl l
 long output format; each text file
 long output format; each text file
-.Sf Nm diff \'d
+.Nm diff Ns \'d
 is piped through
 .Xr pr  1
 to paginate it,
 other differences are remembered and summarized
 after all text file differences are reported.
 is piped through
 .Xr pr  1
 to paginate it,
 other differences are remembered and summarized
 after all text file differences are reported.
-.Tp Fl r
+.It Fl r
 causes application of
 .Nm diff
 recursively to common subdirectories encountered.
 causes application of
 .Nm diff
 recursively to common subdirectories encountered.
-.Tp Fl s
+.It Fl s
 causes
 .Nm diff
 to report files which are the same, which are otherwise not mentioned.
 causes
 .Nm diff
 to report files which are the same, which are otherwise not mentioned.
-.Tc Fl S
-.Ar name
-.Cx
+.It Fl S Ns Ar name
 re-starts a directory
 .Nm diff
 in the middle beginning with file
 .Ar name .
 re-starts a directory
 .Nm diff
 in the middle beginning with file
 .Ar name .
-.Tp
+.El
 .Pp
 If both arguments are directories,
 .Nm diff
 .Pp
 If both arguments are directories,
 .Nm diff
@@ -189,12 +201,12 @@ is applied to the non-directory file and the file contained in
 the directory file with a filename that is the same as the
 last component of the non-directory file.
 .Pp
 the directory file with a filename that is the same as the
 last component of the non-directory file.
 .Pp
-If either the
+If either
 .Ar file1
 or
 .Ar file2
 is
 .Ar file1
 or
 .Ar file2
 is
-.Fl ,
+.Sq Fl ,
 the standard input is
 used in its place.
 .Ss Output Style
 the standard input is
 used in its place.
 .Ss Output Style
@@ -209,10 +221,8 @@ output contains lines of these forms, where
 .Va XX , YY , ZZ , QQ
 are line numbers respective of file order.
 .Pp
 .Va XX , YY , ZZ , QQ
 are line numbers respective of file order.
 .Pp
-.Dp Cx Li XX
-.Ic a
-.Li YY
-.Cx
+.Bl -tag -width "XX,YYcZZ,QQ" -compact
+.It Li XX Ns Ic a Ns Li YY
 At (the end of) line
 .Va XX
 of
 At (the end of) line
 .Va XX
 of
@@ -223,11 +233,7 @@ of line
 of
 .Ar file2
 to make them equal.
 of
 .Ar file2
 to make them equal.
-.Dp Cx Li XX
-.Ic a
-.Li YY ,
-.Li ZZ
-.Cx
+.It Li XX Ns Ic a Ns Li YY,ZZ
 Same as above, but append the range of lines,
 .Va YY
 through
 Same as above, but append the range of lines,
 .Va YY
 through
@@ -237,10 +243,7 @@ of
 to line
 .Va XX
 of file1.
 to line
 .Va XX
 of file1.
-.Dp Cx Li XX
-.Ic d
-.Li YY
-.Cx
+.It Li XX Ns Ic d Ns Li YY
 At line
 .Va XX
 delete
 At line
 .Va XX
 delete
@@ -251,21 +254,14 @@ would bring
 .Ar file1
 in line with
 .Ar file1 .
 .Ar file1
 in line with
 .Ar file1 .
-.Dp Cx Li XX ,
-.Li YY
-.Ic d
-.Li ZZ
-.Cx
+.It Li XX,YY Ns Ic d Ns Li ZZ
 Delete the range of lines
 .Va XX
 through
 .Va YY
 in
 .Ar file1 .
 Delete the range of lines
 .Va XX
 through
 .Va YY
 in
 .Ar file1 .
-.Dp Cx Li XX
-.Ic c
-.Li YY
-.Cx
+.It Li XX Ns Ic c Ns Li YY
 Change the line
 .Va XX
 in
 Change the line
 .Va XX
 in
@@ -274,32 +270,19 @@ to the line
 .Va YY
 in
 .Ar file2.
 .Va YY
 in
 .Ar file2.
-.Dp Cx Li XX ,
-.Li YY
-.Ic c
-.Li ZZ
-.Cx
+.It Li XX,YY Ns Ic c Ns Li ZZ
 Replace the range of specified lines with the line
 .Va ZZ .
 Replace the range of specified lines with the line
 .Va ZZ .
-.Dp Cx Li XX ,
-.Li YY
-.Ic c
-.Li ZZ ,
-.Li QQ
-.Cx
+.It Li XX,YY Ns Ic c Ns Li ZZ,QQ
 Replace the range
 Replace the range
-.Cx Va XX ,
-.Va YY
-.Cx
+.Va XX , Ns YY
 from
 .Ar file1
 with the range
 from
 .Ar file1
 with the range
-.Cx Va ZZ ,
-.Va QQ
-.Cx
+.Va ZZ , Ns QQ
 from
 .Ar file2 .
 from
 .Ar file2 .
-.Dp
+.El
 .Pp
 These lines resemble
 .Xr ed 1
 .Pp
 These lines resemble
 .Xr ed 1
@@ -326,52 +309,50 @@ identical
 pairs (where num1 = num2) are abbreviated as a single
 number.
 .Sh ENVIRONMENT
 pairs (where num1 = num2) are abbreviated as a single
 number.
 .Sh ENVIRONMENT
-.Tw Fl
-.Tp Ev TMPDIR
+.Bl -tag -width TMPDIR
+.It Ev TMPDIR
 If the environment variable
 .Ev TMPDIR
 exists,
 If the environment variable
 .Ev TMPDIR
 exists,
-.Nm Diff
-will use the name specified by
+.Nm diff
+will use the directory specified by
 .Ev TMPDIR
 .Ev TMPDIR
-as an alternate temporary directory.
-.Tp
+as the temporary directory.
+.El
 .Sh FILES
 .Sh FILES
-.Dw /usr/bin/diffh
-.Di L
-.Dp Pa /tmp/d?????
-.br
-.Dp Pa /usr/bin/diffh
+.Bl -tag -width /usr/bin/diffh -compact
+.It Pa /tmp/d?????
+.It Pa /usr/bin/diffh
 Alternate algorithm version (used by option
 .Fl h ) .
 Alternate algorithm version (used by option
 .Fl h ) .
-.Dp Pa /usr/bin/diff
+.It Pa /usr/bin/diff
 for directory diffs
 for directory diffs
-.Dp Pa /usr/bin/pr
+.It Pa /usr/bin/pr
 used by the
 .Fl l
 option.
 used by the
 .Fl l
 option.
-.Dp
+.El
 .Sh SEE ALSO
 .Xr cmp 1 ,
 .Xr cc 1 ,
 .Xr comm 1 ,
 .Xr ed 1 ,
 .Xr diff3 1
 .Sh SEE ALSO
 .Xr cmp 1 ,
 .Xr cc 1 ,
 .Xr comm 1 ,
 .Xr ed 1 ,
 .Xr diff3 1
-.Sh HISTORY
-.Nm Diff
-appeared in Version 6 AT&T Unix.
+.br
+.ne 1i
 .Sh DIAGNOSTICS
 The
 .Nm diff
 utility exits with one of the following values:
 .Sh DIAGNOSTICS
 The
 .Nm diff
 utility exits with one of the following values:
-.Dw Ds
-.Dp \&0
+.Pp
+.Bl -tag -width Ds -compact -offset indent
+.It \&0
 No differences were found.
 No differences were found.
-.Dp \&1
+.It \&1
 Differences were found.
 Differences were found.
-.Dp \&>\&1
+.It "\&>\&1"
 An error occurred.
 An error occurred.
-.Dp
+.El
 .Sh BUGS
 The
 .Fl f
 .Sh BUGS
 The
 .Fl f
@@ -399,4 +380,8 @@ algorithm if they are not equal.
 This may cause a small amount of spurious output if the files
 then turn out to be identical because the only differences are
 insignificant white space or case differences.
 This may cause a small amount of spurious output if the files
 then turn out to be identical because the only differences are
 insignificant white space or case differences.
-.\" .Sh STANDARDS
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v6 .