maint: distinguish EOVERFLOW vs ERANGE better
commit495a35311c0e2fb5b88201b6f2a247750de56579
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 10 Aug 2024 20:00:33 +0000 (10 13:00 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 11 Aug 2024 02:30:01 +0000 (10 19:30 -0700)
tree1ed24d7b0c384a88bc0ebe9f37e1f86fd74a0d3a
parentc5725c8c4bb21903490a48035286d0f94463642e
maint: distinguish EOVERFLOW vs ERANGE better

Also, prepare for allowing some arguments to overflow
without that being an error.
* gl/lib/xdectoint.c: Do not include stddef.h,
since we no longer use ‘unreachable’.
(xnumtoimax, xnumtoumax, __xnumtoint):
New arg FLAGS.  All callers changed.
Stop using __xdectoint_signed.  All definers removed.
* gl/lib/xdectoint.h (XTOINT_MIN_QUIET, XTOINT_MAX_QUIET)
(XTOINT_MIN_RANGE, XTOINT_MAX_RANGE): New flag constants.
* src/fmt.c (main):
* src/fold.c (main):
* src/nl.c (main):
* src/pr.c (getoptnum):
* src/split.c (main):
Use XTOINT_MIN_RANGE and XTOINT_MAX_RANGE if appropriate.
* src/pr.c (getoptnum): Return int rather than returning void
and storing through int *.
* src/stty.c (apply_settings):
Use ckd_add to check for overflow instead of doing it by hand.
(integer_arg): Accept and return uintmax_t, not unsigned long.
12 files changed:
gl/lib/xdectoimax.c
gl/lib/xdectoint.c
gl/lib/xdectoint.h
gl/lib/xdectoumax.c
src/fmt.c
src/fold.c
src/ls.c
src/nl.c
src/pr.c
src/shred.c
src/split.c
src/stty.c