[BACK]Return to cmp.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / cmp

Annotation of src/usr.bin/cmp/cmp.1, Revision 1.1.1.1

1.1       deraadt     1: .\"     $NetBSD: cmp.1,v 1.4 1995/09/08 03:22:55 tls Exp $
                      2: .\"
                      3: .\" Copyright (c) 1987, 1990, 1993
                      4: .\"    The Regents of the University of California.  All rights reserved.
                      5: .\"
                      6: .\" This code is derived from software contributed to Berkeley by
                      7: .\" the Institute of Electrical and Electronics Engineers, Inc.
                      8: .\"
                      9: .\" Redistribution and use in source and binary forms, with or without
                     10: .\" modification, are permitted provided that the following conditions
                     11: .\" are met:
                     12: .\" 1. Redistributions of source code must retain the above copyright
                     13: .\"    notice, this list of conditions and the following disclaimer.
                     14: .\" 2. Redistributions in binary form must reproduce the above copyright
                     15: .\"    notice, this list of conditions and the following disclaimer in the
                     16: .\"    documentation and/or other materials provided with the distribution.
                     17: .\" 3. All advertising materials mentioning features or use of this software
                     18: .\"    must display the following acknowledgement:
                     19: .\"    This product includes software developed by the University of
                     20: .\"    California, Berkeley and its contributors.
                     21: .\" 4. Neither the name of the University nor the names of its contributors
                     22: .\"    may be used to endorse or promote products derived from this software
                     23: .\"    without specific prior written permission.
                     24: .\"
                     25: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     26: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     27: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     28: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     29: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     30: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     31: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     32: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     33: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     34: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     35: .\" SUCH DAMAGE.
                     36: .\"
                     37: .\"     @(#)cmp.1      8.1 (Berkeley) 6/6/93
                     38: .\"
                     39: .Dd June 6, 1993
                     40: .Dt CMP 1
                     41: .Os
                     42: .Sh NAME
                     43: .Nm cmp
                     44: .Nd compare two files
                     45: .Sh SYNOPSIS
                     46: .Nm cmp
                     47: .Op Fl l | Fl s
                     48: .Ar file1 file2
                     49: .Op Ar skip1 Op Ar skip2
                     50: .Sh DESCRIPTION
                     51: The cmp utility compares two files of any type and writes the results
                     52: to the standard output.
                     53: By default,
                     54: .Nm
                     55: is silent if the files are the same; if they differ, the byte
                     56: and line number at which the first difference occurred is reported.
                     57: .Pp
                     58: Bytes and lines are numbered beginning with one.
                     59: .Pp
                     60: The following options are available:
                     61: .Bl -tag -width flag
                     62: .It Fl l
                     63: Print the byte number (decimal) and the differing
                     64: byte values (octal) for each difference.
                     65: .It Fl s
                     66: Print nothing for differing files; return exit
                     67: status only.
                     68: .El
                     69: .Pp
                     70: The optional arguments
                     71: .Ar skip1
                     72: and
                     73: .Ar skip2
                     74: are the byte offsets from the beginning of
                     75: .Ar file1
                     76: and
                     77: .Ar file2 ,
                     78: respectively, where the comparison will begin.
                     79: The offset is decimal by default, but may be expressed as an hexadecimal
                     80: or octal value by preceding it with a leading ``0x'' or ``0''.
                     81: .Pp
                     82: The
                     83: .Nm cmp
                     84: utility exits with one of the following values:
                     85: .Bl -tag -width 4n
                     86: .It 0
                     87: The files are identical.
                     88: .It 1
                     89: The files are different; this includes the case
                     90: where one file is identical to the first part of
                     91: the other.
                     92: In the latter case, if the
                     93: .Fl s
                     94: option has not been specified,
                     95: .Nm cmp
                     96: writes to standard output that EOF was reached in the shorter
                     97: file (before any differences were found).
                     98: .It >1
                     99: An error occurred.
                    100: .El
                    101: .Sh SEE ALSO
                    102: .Xr diff 1 ,
                    103: .Xr diff3 1
                    104: .Sh STANDARDS
                    105: The
                    106: .Nm cmp
                    107: utility is expected to be
                    108: .St -p1003.2
                    109: compatible.