Looks like there's a bit of a spacing goof with 'cmp -l': $ cat /tmp/j1 Jackdaws love my big sphinx of quartz! $ cat /tmp/j2 jackdaws love my big sphinx of quartz. $ ./cmp -l j1 j2 1 112 152 38 41 56
I think this fixes it. diff --git a/src/cmp.c b/src/cmp.c index 16e8869..3124b98 100644 --- a/src/cmp.c +++ b/src/cmp.c @@ -394,7 +394,7 @@ cmp (void) if (comparison_type == type_all_diffs) { - off_t byte_number_max = MIN (bytes, TYPE_MAXIMUM (off_t)); + off_t byte_number_max = bytes >= 0 ? bytes : TYPE_MAXIMUM (off_t); for (f = 0; f < 2; f++) if (S_ISREG (stat_buf[f].st_mode)) diff --git a/tests/cmp b/tests/cmp index 97f2b5f..ff49388 100755 --- a/tests/cmp +++ b/tests/cmp @@ -218,4 +218,14 @@ case `LC_ALL=C cmp -b bad bug` in *) echo 'expected cmp -b to report a and u'; fail=1;; esac +printf 'Jackdaws love my big sphinx of quartz!' > j1 +printf 'jackdaws love my big sphinx of quartz.' > j2 +cat <<'EOF' > exp2 || fail=1 + 1 112 J 152 j +38 41 ! 56 . +EOF +cmp -bl j1 j2 > out2 +test $? -eq 1 || fail=1 +compare exp2 out2 || fail=1 + Exit $fail Dave Odell