blob: a3ab1c9ba0221994520437baf058ec34f7171664 [file] [log] [blame]
rsccfa37a72004-04-10 18:53:55 +00001.TH CMP 1
2.SH NAME
3cmp \- compare two files
4.SH SYNOPSIS
5.B cmp
6[
7.B -lsL
8]
9.I file1 file2
10[
11.I offset1
12[
13.I offset2
14]
15]
16.SH DESCRIPTION
17The two files are
18compared.
19A diagnostic results if the contents differ, otherwise
20there is no output.
21.PP
22The options are:
23.TP
24.B l
25Print the byte number (decimal) and the
26differing bytes (hexadecimal) for each difference.
27.TP
28.B s
29Print nothing for differing files,
30but set the exit status.
31.TP
32.B L
33Print the line number of the first differing byte.
34.PP
35If offsets are given,
36comparison starts at the designated byte position
37of the corresponding file.
38Offsets that begin with
39.B 0x
40are hexadecimal;
41with
42.BR 0 ,
43octal; with anything else, decimal.
44.SH SOURCE
rscc3674de2005-01-11 17:37:33 +000045.B \*9/src/cmd/cmp.c
rsccfa37a72004-04-10 18:53:55 +000046.SH "SEE ALSO"
47.IR diff (1)
48.SH DIAGNOSTICS
49If a file is inaccessible or missing, the exit status is
50.LR open .
51If the files are the same, the exit status is empty (true).
52If they are the same except that one is longer than the other, the exit status is
53.LR EOF .
54Otherwise
55.I cmp
56reports the position of the first disagreeing byte and the exit status is
57.LR differ .