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