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