4 # if STRING_TO_UNSIGNED
5 # define __xstrtol xstrtoul
6 # define __strtol strtoul
7 # define __unsigned unsigned
8 # define __ZLONG_MAX ULONG_MAX
10 # define __xstrtol xstrtol
11 # define __strtol strtol
12 # define __unsigned /* empty */
13 # define __ZLONG_MAX LONG_MAX
17 # if defined (__STDC__) && __STDC__
18 # define PARAMS(Args) Args
20 # define PARAMS(Args) ()
26 LONGINT_OK
, LONGINT_INVALID
, LONGINT_INVALID_SUFFIX_CHAR
, LONGINT_OVERFLOW
28 typedef enum strtol_error strtol_error
;
32 __xstrtol
PARAMS ((const char *s
, char **ptr
, int base
,
33 __unsigned
long int *val
, const char *valid_suffixes
));
36 # define _STRTOL_ERROR(Exit_code, Str, Argument_type_string, Err) \
44 case LONGINT_INVALID: \
45 error ((Exit_code), 0, "invalid %s `%s'", \
46 (Argument_type_string), (Str)); \
49 case LONGINT_INVALID_SUFFIX_CHAR: \
50 error ((Exit_code), 0, "invalid character following %s `%s'", \
51 (Argument_type_string), (Str)); \
54 case LONGINT_OVERFLOW: \
55 /* FIXME: make this message dependent on STRING_TO_UNSIGNED */\
56 error ((Exit_code), 0, "%s `%s' larger than maximum long int",\
57 (Argument_type_string), (Str)); \
63 # define STRTOL_FATAL_ERROR(Str, Argument_type_string, Err) \
64 _STRTOL_ERROR (2, Str, Argument_type_string, Err)
66 # define STRTOL_FAIL_WARN(Str, Argument_type_string, Err) \
67 _STRTOL_ERROR (0, Str, Argument_type_string, Err)
69 #endif /* not XSTRTOL_H_ */