HomeFreeBSD

diff: Tweak range of -C and -U arguments

Description

diff: Tweak range of -C and -U arguments

POSIX uses the terms “positive decimal integer” for -C and “non-negative
decimal integer” for -U, which translates into lower bounds of 1 for -C
and 0 for -U.

POSIX does not specify a minimum upper bound for either mode, but as of
5fc739eb5949 both our backends support context sizes up to and including
INT_MAX, so use that.

Having had the opportunity to consult the Unix System Test Suite, the
diff test cases found therein happen to precisely match these bounds.

While here, switch to using strtonum() to parse numerical arguments, and
try to be more consistent in how we report usage errors.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D55261

Details

Provenance
desAuthored on Feb 13 2026, 8:18 PM
Reviewer
kevans
Differential Revision
D55261: diff: Tweak range of -C and -U arguments
Parents
rG596bf3485fe5: bpf: don't call bpf_detachd() in bpf_setdlt()
Branches
Unknown
Tags
Unknown