cmp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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
  45. .B /sys/src/cmd/cmp.c
  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 .