postgresql/src/fe_utils
Michael Paquier 6f164e6d17 Unify parsing logic for command-line integer options
Most of the integer options for command-line binaries now make use of a
single routine able to do the job, fixing issues with the detection of
sloppy values caused for example by the use of atoi(), that fails on
strings beginning with numerical characters with junk trailing
characters.

This commit cuts down the number of strings requiring translation by 26
per my count, switching the code to have two error types for invalid and
out-of-range values instead.

Much more could be done here, with float or even int64 options, but
int32 was the most appealing case as it is possible to rely on strtol()
to do the job reliably.  Note that there are some exceptions for now,
like pg_ctl or pg_upgrade that use their own logging logic.  A couple of
negative TAP tests required some adjustments for the new errors
generated.

pg_dump and pg_restore tracked the maximum number of parallel jobs
within the option parsing.  The code is refactored a bit to track that
in the code dedicated to parallelism instead.

Author: Kyotaro Horiguchi, Michael Paquier
Reviewed-by: David Rowley, Álvaro Herrera
Discussion: https://postgr.es/m/CALj2ACXqdG9WhqVoJ9zYf-iZt7sgK7Szv5USs=he6NnWQ2ofTA@mail.gmail.com
2021-07-24 18:35:03 +09:00
..
.gitignore Move psql's psqlscan.l into src/fe_utils. 2016-03-24 20:28:47 -04:00
archive.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
cancel.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
conditional.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
connect_utils.c Move some code from src/bin/scripts to src/fe_utils to permit reuse. 2021-02-05 13:33:38 -05:00
Makefile Move some code from src/bin/scripts to src/fe_utils to permit reuse. 2021-02-05 13:33:38 -05:00
mbprint.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
option_utils.c Unify parsing logic for command-line integer options 2021-07-24 18:35:03 +09:00
parallel_slot.c Refactor and generalize the ParallelSlot machinery. 2021-03-11 13:17:46 -05:00
print.c Fix incautious handling of possibly-miscoded strings in client code. 2021-06-07 14:15:25 -04:00
psqlscan.l psql: Fix line continuation prompts for unbalanced parentheses 2021-04-29 09:04:31 +02:00
query_utils.c Move some code from src/bin/scripts to src/fe_utils to permit reuse. 2021-02-05 13:33:38 -05:00
recovery_gen.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
simple_list.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
string_utils.c Fix incautious handling of possibly-miscoded strings in client code. 2021-06-07 14:15:25 -04:00