xref: /csrg-svn/usr.bin/cmp/cmp.1 (revision 50070)
143082Scael.\" Copyright (c) 1987, 1990 The Regents of the University of California.
243082Scael.\" All rights reserved.
319387Smckusick.\"
443082Scael.\" %sccs.include.redist.man%
532644Sbostic.\"
6*50070Sbostic.\"     @(#)cmp.1	6.6 (Berkeley) 06/17/91
743082Scael.\"
843082Scael.Dd
943082Scael.Dt CMP 1
1047399Scael.Os
1143082Scael.Sh NAME
1243082Scael.Nm cmp
1343082Scael.Nd compare two files
1443082Scael.Sh SYNOPSIS
1543082Scael.Nm cmp
1644952Scael.Op Fl l Li \&| Fl s
1743082Scael.Ar file1 file2
1843082Scael.Sh DESCRIPTION
1944952ScaelThe cmp utility compares two files of any type and
2044952Scaelwrites the results to the standard output.
21*50070SbosticBy default,
2244952Scael.Nm
23*50070Sbosticis silent if the files are the same; if they differ, the byte
24*50070Sbosticand line number at which the first difference occurred is reported.
2543082Scael.Pp
26*50070SbosticBytes and lines are numbered beginning with one.
27*50070Sbostic.Pp
2843082ScaelThe following options are available:
2947399Scael.Bl -tag -width Ds
3047399Scael.It Fl l
3143082ScaelPrint the byte number (decimal) and the differing
32*50070Sbosticbyte values (octal) for each difference.
3347399Scael.It Fl s
3443082ScaelPrint nothing for differing files; return exit
3543082Scaelstatus only.
3647399Scael.El
3743082Scael.Pp
3843082ScaelIf
3943082Scael.Ar file1
40*50070Sbosticor
41*50070Sbostic.Ar file2
42*50070Sbosticis ``-'', the the standard input is used.
4343082Scael.Pp
4443082ScaelThe
4543082Scael.Nm cmp
4643082Scaelutility exits with one of the following values:
4747399Scael.Bl -tag -width 4n
4847399Scael.It 0
4943082ScaelThe files are identical.
5047399Scael.It 1
5143082ScaelThe files are different; this includes the case
5243082Scaelwhere one file is identical to the first part of
5343082Scaelthe other.
5444952ScaelIn the latter case, if the
5544952Scael.Fl s
5644952Scaeloption has
5743082Scaelnot been specified, cmp writes to standard error
5843082Scaelthat EOF was reached in the shorter file (before
5943082Scaelany differences were found).
6047399Scael.It >1
6143082ScaelAn error occurred.
6247399Scael.El
6343082Scael.Sh SEE ALSO
6444952Scael.Xr diff 1 ,
6544952Scael.Xr diff3 1
6643082Scael.Sh STANDARDS
6743082ScaelThe
6843082Scael.Nm cmp
6943082Scaelfunction is expected to be POSIX 1003.2 compatible.
70