diff options
author | obrien <obrien@FreeBSD.org> | 2001-02-27 13:33:07 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2001-02-27 13:33:07 +0000 |
commit | bb70e1687a5a72cc582496d32293aed2b63f5647 (patch) | |
tree | a6ddbcda2c8416d0bced69bd65a91d752bc75d50 /lib/libc/stdlib/strtoul.3 | |
parent | a7aa01b9b6a44b97d7111edaa5ab21b829093ccd (diff) | |
download | FreeBSD-src-bb70e1687a5a72cc582496d32293aed2b63f5647.zip FreeBSD-src-bb70e1687a5a72cc582496d32293aed2b63f5647.tar.gz |
Impliment the ISO-C99 strto[u]ll()
and rewrite strto[u]q() in terms of it.
Diffstat (limited to 'lib/libc/stdlib/strtoul.3')
-rw-r--r-- | lib/libc/stdlib/strtoul.3 | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/lib/libc/stdlib/strtoul.3 b/lib/libc/stdlib/strtoul.3 index d3e9696..ebd9268 100644 --- a/lib/libc/stdlib/strtoul.3 +++ b/lib/libc/stdlib/strtoul.3 @@ -40,8 +40,8 @@ .Dt STRTOUL 3 .Os .Sh NAME -.Nm strtoul , strtouq -.Nd "convert a string to an unsigned long or uquad_t integer" +.Nm strtoul , strtoull , strtouq +.Nd "convert a string to an unsigned long , unsigned long long , or uquad_t integer" .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -49,6 +49,8 @@ .Fd #include <limits.h> .Ft unsigned long .Fn strtoul "const char *nptr" "char **endptr" "int base" +.Ft unsigned long long +.Fn strtoull "const char *nptr" "char **endptr" "int base" .Fd #include <sys/types.h> .Fd #include <stdlib.h> .Fd #include <limits.h> @@ -64,6 +66,14 @@ to an .Em unsigned long value. The +.Fn strtoull +function +converts the string in +.Fa nptr +to an +.Em unsigned long long +value. +The .Fn strtouq function converts the string in @@ -143,10 +153,21 @@ unless the original (non-negated) value would overflow; in the latter case, .Fn strtoul returns -.Dv ULONG_MAX -and sets the global variable +.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, +.Fn strtoull +returns +.Dv ULLONG_MAX . +In all cases, .Va errno -to +is set to .Er ERANGE . .Sh ERRORS .Bl -tag -width Er @@ -161,5 +182,13 @@ The function conforms to .St -isoC . +The +.Fn strtoull +function +conforms to +.St -isoC-99 . +The BSD +.Fn strtoq +function is deprecated. .Sh BUGS Ignores the current locale. |