cvsdist 70d82c0
.\" Copyright (c) 1987, 1990, 1993
cvsdist 70d82c0
.\"	The Regents of the University of California.  All rights reserved.
cvsdist 70d82c0
.\"
cvsdist 70d82c0
.\" This code is derived from software contributed to Berkeley by
cvsdist 70d82c0
.\" the Institute of Electrical and Electronics Engineers, Inc.
cvsdist 70d82c0
.\"
cvsdist 70d82c0
.\" Redistribution and use in source and binary forms, with or without
cvsdist 70d82c0
.\" modification, are permitted provided that the following conditions
cvsdist 70d82c0
.\" are met:
cvsdist 70d82c0
.\" 1. Redistributions of source code must retain the above copyright
cvsdist 70d82c0
.\"    notice, this list of conditions and the following disclaimer.
cvsdist 70d82c0
.\" 2. Redistributions in binary form must reproduce the above copyright
cvsdist 70d82c0
.\"    notice, this list of conditions and the following disclaimer in the
cvsdist 70d82c0
.\"    documentation and/or other materials provided with the distribution.
cvsdist 70d82c0
.\" 3. All advertising materials mentioning features or use of this software
cvsdist 70d82c0
.\"    must display the following acknowledgement:
cvsdist 70d82c0
.\"	This product includes software developed by the University of
cvsdist 70d82c0
.\"	California, Berkeley and its contributors.
cvsdist 70d82c0
.\" 4. Neither the name of the University nor the names of its contributors
cvsdist 70d82c0
.\"    may be used to endorse or promote products derived from this software
cvsdist 70d82c0
.\"    without specific prior written permission.
cvsdist 70d82c0
.\"
cvsdist 70d82c0
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
cvsdist 70d82c0
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
cvsdist 70d82c0
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
cvsdist 70d82c0
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
cvsdist 70d82c0
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
cvsdist 70d82c0
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
cvsdist 70d82c0
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
cvsdist 70d82c0
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
cvsdist 70d82c0
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
cvsdist 70d82c0
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
cvsdist 70d82c0
.\" SUCH DAMAGE.
cvsdist 70d82c0
.\"
cvsdist 70d82c0
.\"     @(#)cmp.1	8.1 (Berkeley) 6/6/93
cvsdist 70d82c0
.\"
cvsdist 70d82c0
.Dd June 6, 1993
cvsdist 70d82c0
.Dt CMP 1
cvsdist 70d82c0
.Os
cvsdist 70d82c0
.Sh NAME
cvsdist 70d82c0
.Nm cmp
cvsdist 70d82c0
.Nd compare two files
cvsdist 70d82c0
.Sh SYNOPSIS
cvsdist 70d82c0
.Nm cmp
cvsdist 70d82c0
.Op Fl l | Fl s
cvsdist 70d82c0
.Ar file1 file2
cvsdist 70d82c0
.Op Ar skip1 Op Ar skip2
cvsdist 70d82c0
.Sh DESCRIPTION
cvsdist 70d82c0
The cmp utility compares two files of any type and writes the results
cvsdist 70d82c0
to the standard output.
cvsdist 70d82c0
By default,
cvsdist 70d82c0
.Nm
cvsdist 70d82c0
is silent if the files are the same; if they differ, the byte
cvsdist 70d82c0
and line number at which the first difference occurred is reported.
cvsdist 70d82c0
.Pp
cvsdist 70d82c0
Bytes and lines are numbered beginning with one.
cvsdist 70d82c0
.Pp
cvsdist 70d82c0
The following options are available:
cvsdist 70d82c0
.Bl -tag -width flag
cvsdist 70d82c0
.It Fl l
cvsdist 70d82c0
Print the byte number (decimal) and the differing
cvsdist 70d82c0
byte values (octal) for each difference.
cvsdist 70d82c0
.It Fl s
cvsdist 70d82c0
Print nothing for differing files; return exit
cvsdist 70d82c0
status only.
cvsdist 70d82c0
.El
cvsdist 70d82c0
.Pp
cvsdist 70d82c0
The optional arguments
cvsdist 70d82c0
.Ar skip1
cvsdist 70d82c0
and 
cvsdist 70d82c0
.Ar skip2
cvsdist 70d82c0
are the byte offsets from the beginning of
cvsdist 70d82c0
.Ar file1
cvsdist 70d82c0
and
cvsdist 70d82c0
.Ar file2 ,
cvsdist 70d82c0
respectively, where the comparison will begin.
cvsdist 70d82c0
The offset is decimal by default, but may be expressed as an hexadecimal
cvsdist 70d82c0
or octal value by preceding it with a leading ``0x'' or ``0''.
cvsdist 70d82c0
.Pp
cvsdist 70d82c0
The
cvsdist 70d82c0
.Nm cmp
cvsdist 70d82c0
utility exits with one of the following values:
cvsdist 70d82c0
.Bl -tag -width 4n
cvsdist 70d82c0
.It 0
cvsdist 70d82c0
The files are identical.
cvsdist 70d82c0
.It 1
cvsdist 70d82c0
The files are different; this includes the case
cvsdist 70d82c0
where one file is identical to the first part of
cvsdist 70d82c0
the other.
cvsdist 70d82c0
In the latter case, if the
cvsdist 70d82c0
.Fl s
cvsdist 70d82c0
option has not been specified,
cvsdist 70d82c0
.Nm cmp
cvsdist 70d82c0
writes to standard output that EOF was reached in the shorter
cvsdist 70d82c0
file (before any differences were found).
cvsdist 70d82c0
.It >1
cvsdist 70d82c0
An error occurred.
cvsdist 70d82c0
.El
cvsdist 70d82c0
.Sh SEE ALSO
cvsdist 70d82c0
.Xr diff 1 ,
cvsdist 70d82c0
.Xr diff3 1
cvsdist 70d82c0
.Sh STANDARDS
cvsdist 70d82c0
The
cvsdist 70d82c0
.Nm cmp
cvsdist 70d82c0
utility is expected to be
cvsdist 70d82c0
.St -p1003.2
cvsdist 70d82c0
compatible.