fix '-' parsing; make -l, -s mutually exclusive, KNF cleanups
[unix-history] / usr / src / usr.bin / cmp / cmp.1
CommitLineData
d0e4a4f2
KB
1.\" Copyright (c) 1987 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
ea1077d3 5.\" @(#)cmp.1 6.2 (Berkeley) %G%
85ae1ebc 6.\"
0aa1e165 7.TH CMP 1 ""
85ae1ebc
KM
8.AT 3
9.SH NAME
10cmp \- compare two files
11.SH SYNOPSIS
12.B cmp
13[
14.B \-l
15] [
16.B \-s
d0e4a4f2 17] file1 file2 [ skip1 [ skip2 ]]
85ae1ebc 18.SH DESCRIPTION
d0e4a4f2
KB
19The two files are compared. (If \fIfile1\fP is `\-', the standard
20input is used.) With no options, \fIcmp\fP makes no comment if the
21files are the same; if they differ, it reports the byte and line
22number at which the difference occurred, or, that one file is an
23initial subsequence of the other. \fISkip1\fP and \fIskip2\fP are
24initial byte offsets into \fIfile1\fP and \fIfile2\fP respectively,
25and may be either octal or decimal; a leading ``0'' denotes octal.
85ae1ebc
KM
26.PP
27Options:
28.TP 6
d0e4a4f2
KB
29.B \-s
30Print nothing for differing files; set exit codes only.
85ae1ebc 31.TP 6
d0e4a4f2
KB
32.B \-l
33Print the byte number (in decimal) and the differing bytes (in octal)
34for all differences between the two files.
85ae1ebc
KM
35.SH "SEE ALSO"
36diff(1), comm(1)
37.SH DIAGNOSTICS
d0e4a4f2
KB
38Exit code 0 is returned for identical files, 1 for different files,
39and 2 for an inaccessible or missing argument, or a system error.