diff options
author | Jim Meyering <jim@meyering.net> | 1997-01-25 06:13:46 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-01-25 06:13:46 +0000 |
commit | 186d893f2797045ccd8c9abc13ea6cce36f19569 (patch) | |
tree | cf792749b22fe665ade5e9fa558ab4c572bfa72d /lib | |
parent | edeada009c94806b9caf2e7abb9c15c8fdcb87e9 (diff) | |
download | coreutils-186d893f2797045ccd8c9abc13ea6cce36f19569.tar.xz |
(__xstrtol): Change interpretation of
VALID_SUFFIXES == NULL vs VALID_SUFFIXES == "". Use the former
when any suffix is valid, the later when no suffix is allowed.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/xstrtol.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/xstrtol.c b/lib/xstrtol.c index fea6c4801..ad2bcdbf1 100644 --- a/lib/xstrtol.c +++ b/lib/xstrtol.c @@ -91,15 +91,14 @@ __xstrtol (s, ptr, base, val, valid_suffixes) return LONGINT_OVERFLOW; if (*p == s) return LONGINT_INVALID; + + /* Let valid_suffixes == NULL mean `allow any suffix'. */ + /* FIXME: update all callers except the one in tail.c changing + last parameter NULL to `""'. */ if (!valid_suffixes) { - if (**p == '\0') - { - *val = tmp; - return LONGINT_OK; - } - else - return LONGINT_INVALID_SUFFIX_CHAR; + *val = tmp; + return LONGINT_OK; } if (**p != '\0') |