doc: remove extraneous periods from option --help
[coreutils.git] / gl / lib / xdectoint.h
blob17db93dc2947edf3f08f6f7f8d00d30db117eff5
1 /* Convert decimal strings with bounds checking and exit on error.
3 Copyright (C) 2014-2024 Free Software Foundation, Inc.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18 #ifndef XDECTOINT_H_
19 # define XDECTOINT_H_ 1
21 # include <inttypes.h>
23 /* Flags for xnumtoimax and xnumtoumax. They can be ORed togethar. */
24 enum
26 /* If the number is less than MIN, do not diagnose the problem;
27 instead, return MIN and set errno to EOVERFLOW or ERANGE. */
28 XTOINT_MIN_QUIET = 1 << 0,
30 /* Likewise for the MAX argument. */
31 XTOINT_MAX_QUIET = 1 << 1,
33 /* The MIN argument is imposed by the caller, not by the type of
34 the result. This causes the function to use ERANGE rather
35 than EOVERFLOW behavior when issuing diagnostics or setting errno. */
36 XTOINT_MIN_RANGE = 1 << 2,
38 /* Likewise for the MAX argument. */
39 XTOINT_MAX_RANGE = 1 << 3
42 # define _DECLARE_XDECTOINT(name, type) \
43 type name (char const *n_str, type min, type max, \
44 char const *suffixes, char const *err, int err_exit) \
45 _GL_ATTRIBUTE_NONNULL ((1, 5));
46 # define _DECLARE_XNUMTOINT(name, type) \
47 type name (char const *n_str, int base, type min, type max, \
48 char const *suffixes, char const *err, int err_exit, int flags) \
49 _GL_ATTRIBUTE_NONNULL ((1, 6));
51 _DECLARE_XDECTOINT (xdectoimax, intmax_t)
52 _DECLARE_XDECTOINT (xdectoumax, uintmax_t)
54 _DECLARE_XNUMTOINT (xnumtoimax, intmax_t)
55 _DECLARE_XNUMTOINT (xnumtoumax, uintmax_t)
57 #endif /* not XDECTOINT_H_ */