1
0

cmp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .TH CMP 1
  2. .SH NAME
  3. cmp \- compare two files
  4. .SH SYNOPSIS
  5. .B cmp
  6. [
  7. .B -lLs
  8. ]
  9. .I file1 file2
  10. [
  11. .I offset1
  12. [
  13. .I offset2
  14. ]
  15. ]
  16. .SH DESCRIPTION
  17. .I Cmp
  18. compares the two files and prints
  19. a message if the contents differ.
  20. .PP
  21. The options are:
  22. .TP
  23. .B -l
  24. Print the byte number (decimal) and the
  25. differing bytes (hexadecimal) for each difference.
  26. .TP
  27. .B -L
  28. Print the line number of the first differing byte.
  29. .TP
  30. .B -s
  31. Print nothing for differing files,
  32. but set the exit status.
  33. .PD
  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 .