freebsd-dev/usr.bin/cmp
Ed Maste 80445b7a3f cmp: fix -s (silent) when used with skip offsets
-s causes cmp to print nothing for differing files, for use when only
the exit status is of interest.

-z compares the file size first, for regular files, and fails the
comparison early if they do not match.

Prior to this change -s implied -z as an optimization, but this is not
valid when file offsets are specified.  Now, enable the -z optimization
for -s only if both skip arguments are not provided / 0.

Note that using -z with differing skip values will currently always
fail.  We may want to compare size1 - skip1 with size2 - skip2 instaead,
and in any case the man page should be clarified.

PR:		252542
Fixes:		3e6902efc8
Reported by:	William Ahern
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28071
2021-01-10 19:02:56 -05:00
..
tests cmp: fix -s (silent) when used with skip offsets 2021-01-10 19:02:56 -05:00
cmp.1 cmp(1): Add EXAMPLES section 2020-06-20 11:20:16 +00:00
cmp.c cmp: fix -s (silent) when used with skip offsets 2021-01-10 19:02:56 -05:00
extern.h cmp: use C99 bool for flags 2021-01-10 19:02:55 -05:00
link.c cmp: use C99 bool for flags 2021-01-10 19:02:55 -05:00
Makefile Add HAS_TESTS to all Makefiles that are currently using the 2017-08-02 08:50:42 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
misc.c cmp: use C99 bool for flags 2021-01-10 19:02:55 -05:00
regular.c Fix handling of rights on stdio streams, take two. 2019-02-25 19:47:27 +00:00
special.c Fix handling of rights on stdio streams, take two. 2019-02-25 19:47:27 +00:00