summaryrefslogtreecommitdiff
path: root/lib/xstrtol.h
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-10-15 07:26:36 +0000
committerJim Meyering <jim@meyering.net>2003-10-15 07:26:36 +0000
commitc8043fb65526afc32b67b92fca8f581fc9696233 (patch)
tree593cc4c76a6489f3a9c52e9b453a451a13bc0332 /lib/xstrtol.h
parent7edceab01c96c3847b7f22f70357ab8418c2e8dc (diff)
downloadcoreutils-c8043fb65526afc32b67b92fca8f581fc9696233.tar.xz
Sync with gnulib.
Diffstat (limited to 'lib/xstrtol.h')
-rw-r--r--lib/xstrtol.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/xstrtol.h b/lib/xstrtol.h
index 9af90aad3..f3b9295f3 100644
--- a/lib/xstrtol.h
+++ b/lib/xstrtol.h
@@ -32,7 +32,16 @@
# ifndef _STRTOL_ERROR
enum strtol_error
{
- LONGINT_OK, LONGINT_INVALID, LONGINT_INVALID_SUFFIX_CHAR, LONGINT_OVERFLOW
+ LONGINT_OK = 0,
+
+ /* These two values can be ORed together, to indicate that both
+ errors occurred. */
+ LONGINT_OVERFLOW = 1,
+ LONGINT_INVALID_SUFFIX_CHAR = 2,
+
+ LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW = (LONGINT_INVALID_SUFFIX_CHAR
+ | LONGINT_OVERFLOW),
+ LONGINT_INVALID = 4
};
typedef enum strtol_error strtol_error;
# endif
@@ -49,7 +58,7 @@ _DECLARE_XSTRTOL (xstrtoumax, uintmax_t)
{ \
switch ((Err)) \
{ \
- case LONGINT_OK: \
+ default: \
abort (); \
\
case LONGINT_INVALID: \
@@ -58,6 +67,7 @@ _DECLARE_XSTRTOL (xstrtoumax, uintmax_t)
break; \
\
case LONGINT_INVALID_SUFFIX_CHAR: \
+ case LONGINT_INVALID_SUFFIX_CHAR | LONGINT_OVERFLOW: \
error ((Exit_code), 0, "invalid character following %s in `%s'", \
(Argument_type_string), (Str)); \
break; \