1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A more useful interface to strtol.
5 Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2011 Free Software
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 # include <inttypes.h>
27 # ifndef _STRTOL_ERROR
32 /* These two values can be ORed together, to indicate that both
35 LONGINT_INVALID_SUFFIX_CHAR = 2,
37 LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW = (LONGINT_INVALID_SUFFIX_CHAR
41 typedef enum strtol_error strtol_error;
44 # define _DECLARE_XSTRTOL(name, type) \
45 strtol_error name (const char *, char **, int, type *, const char *);
46 _DECLARE_XSTRTOL (xstrtol, long int)
47 _DECLARE_XSTRTOL (xstrtoul, unsigned long int)
48 _DECLARE_XSTRTOL (xstrtoimax, intmax_t)
49 _DECLARE_XSTRTOL (xstrtoumax, uintmax_t)
51 #if HAVE_LONG_LONG_INT
52 _DECLARE_XSTRTOL (xstrtoll, long long int)
53 _DECLARE_XSTRTOL (xstrtoull, unsigned long long int)
56 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
57 # define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
59 # define _GL_ATTRIBUTE_NORETURN /* empty */
62 /* Report an error for an invalid integer in an option argument.
64 ERR is the error code returned by one of the xstrto* functions.
66 Use OPT_IDX to decide whether to print the short option string "C"
67 or "-C" or a long option string derived from LONG_OPTION. OPT_IDX
68 is -2 if the short option "C" was used, without any leading "-"; it
69 is -1 if the short option "-C" was used; otherwise it is an index
70 into LONG_OPTIONS, which should have a name preceded by two '-'
73 ARG is the option-argument containing the integer.
75 After reporting an error, exit with a failure status. */
77 void xstrtol_fatal (enum strtol_error,
78 int, char, struct option const *,
79 char const *) _GL_ATTRIBUTE_NORETURN;
81 #endif /* not XSTRTOL_H_ */