diff options
author | ache <ache@FreeBSD.org> | 2001-09-04 16:39:11 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-09-04 16:39:11 +0000 |
commit | cd61d5ab4817c934f249aeb6e7b6ccf8ee382706 (patch) | |
tree | 7bcee0477a1db7819fa0b437d2bfb0714a1119df /lib/libc/stdlib/strtoul.3 | |
parent | 29e117e97875b5c4c297c48dae32a287e46e1785 (diff) | |
download | FreeBSD-src-cd61d5ab4817c934f249aeb6e7b6ccf8ee382706.zip FreeBSD-src-cd61d5ab4817c934f249aeb6e7b6ccf8ee382706.tar.gz |
Locale *is* used in strto*l*(), at least for isspace(), so remove
'locale not used' statement from comments and BUGS section of manpage.
strtol(): fix non-portable 'cutoff' calculation using the same method as
in strtoll().
Cleanup 'cutoff' calculation, remove unneded casts. Misc. cleanup to
make all functions looks the same.
Implement EINVAL reaction per POSIX, document it in manpage, corresponding
POSIX example quotes here:
------------------------------------------------
If the subject sequence is empty or does not have the expected form, no
conversion is performed; the value of str is stored in the object pointed
to by endptr, provided that endptr is not a null pointer.
If no conversion could be performed, 0 shall be returned and errno may be
set to [EINVAL].
[EINVAL] The value of base is not supported.
Since 0, {LONG_MIN} or {LLONG_MIN}, and {LONG_MAX} or {LLONG_MAX} are
returned on error and are also valid returns on success, an application
wishing to check for error situations should set errno to 0, then call
strtol( ) or strtoll ( ), then check errno.
-----------------------------------------------------
Diffstat (limited to 'lib/libc/stdlib/strtoul.3')
-rw-r--r-- | lib/libc/stdlib/strtoul.3 | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/libc/stdlib/strtoul.3 b/lib/libc/stdlib/strtoul.3 index 6f89af8..cf893ee 100644 --- a/lib/libc/stdlib/strtoul.3 +++ b/lib/libc/stdlib/strtoul.3 @@ -145,6 +145,8 @@ on return, the entire string was valid.) .Sh RETURN VALUES The .Fn strtoul +or +.Fn strtoull function returns either the result of the conversion or, if there was a leading minus sign, @@ -153,15 +155,8 @@ unless the original (non-negated) value would overflow; in the latter case, .Fn strtoul returns -.Dv ULONG_MAX . -The -.Fn strtoull -function -returns either the result of the conversion -or, if there was a leading minus sign, -the negation of the result of the conversion, -unless the original (non-negated) value would overflow; -in the latter case, +.Dv ULONG_MAX +and .Fn strtoull returns .Dv ULLONG_MAX . @@ -169,8 +164,16 @@ In all cases, .Va errno is set to .Er ERANGE . +If no conversion could be performed, 0 shall be returned and +.Va errno +will be +set to +.Er EINVAL . .Sh ERRORS .Bl -tag -width Er +.It Bq Er EINVAL +The value of base is not supported or +no conversion could be performed. .It Bq Er ERANGE The given string was out of range; the value converted has been clamped. .El @@ -191,5 +194,3 @@ The .Bx .Fn strtoq function is deprecated. -.Sh BUGS -Ignores the current locale. |