4 # if STRING_TO_UNSIGNED
5 # define __xstrtol xstrtoul
6 # define __strtol strtoul
7 # define __unsigned unsigned
9 # define __xstrtol xstrtol
10 # define __strtol strtol
11 # define __unsigned /* empty */
15 # if defined PROTOTYPES || (defined __STDC__ && __STDC__)
16 # define PARAMS(Args) Args
18 # define PARAMS(Args) ()
22 # ifndef _STRTOL_ERROR
25 LONGINT_OK
, LONGINT_INVALID
, LONGINT_INVALID_SUFFIX_CHAR
, LONGINT_OVERFLOW
27 typedef enum strtol_error strtol_error
;
31 __xstrtol
PARAMS ((const char *s
, char **ptr
, int base
,
32 __unsigned
long int *val
, const char *valid_suffixes
));
35 # define _STRTOL_ERROR(Exit_code, Str, Argument_type_string, Err) \
43 case LONGINT_INVALID: \
44 error ((Exit_code), 0, "invalid %s `%s'", \
45 (Argument_type_string), (Str)); \
48 case LONGINT_INVALID_SUFFIX_CHAR: \
49 error ((Exit_code), 0, "invalid character following %s `%s'", \
50 (Argument_type_string), (Str)); \
53 case LONGINT_OVERFLOW: \
54 /* FIXME: make this message dependent on STRING_TO_UNSIGNED */\
55 error ((Exit_code), 0, "%s `%s' larger than maximum long int",\
56 (Argument_type_string), (Str)); \
62 # define STRTOL_FATAL_ERROR(Str, Argument_type_string, Err) \
63 _STRTOL_ERROR (2, Str, Argument_type_string, Err)
65 # define STRTOL_FAIL_WARN(Str, Argument_type_string, Err) \
66 _STRTOL_ERROR (0, Str, Argument_type_string, Err)
68 #endif /* not XSTRTOL_H_ */