aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/strtol.3
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2001-02-27 13:33:07 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2001-02-27 13:33:07 +0000
commit4c0440cb8652801c1c3750a474f7ddbb17897cdf (patch)
treeeb116378d50e15fc35d1602c0784e9b8bd920e36 /lib/libc/stdlib/strtol.3
parent1b0dabf0c01e7ada145b752392609ed5438971df (diff)
downloadsrc-4c0440cb8652801c1c3750a474f7ddbb17897cdf.tar.gz
src-4c0440cb8652801c1c3750a474f7ddbb17897cdf.zip
Impliment the ISO-C99 strto[u]ll()
and rewrite strto[u]q() in terms of it.
Notes
Notes: svn path=/head/; revision=73152
Diffstat (limited to 'lib/libc/stdlib/strtol.3')
-rw-r--r--lib/libc/stdlib/strtol.337
1 files changed, 34 insertions, 3 deletions
diff --git a/lib/libc/stdlib/strtol.3 b/lib/libc/stdlib/strtol.3
index 3f28713235b6..eef3031c1e6d 100644
--- a/lib/libc/stdlib/strtol.3
+++ b/lib/libc/stdlib/strtol.3
@@ -40,8 +40,8 @@
.Dt STRTOL 3
.Os
.Sh NAME
-.Nm strtol , strtoq
-.Nd convert string value to a long or quad_t integer
+.Nm strtol , strtoll , strtoq
+.Nd convert string value to a long , long long , or quad_t integer
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
@@ -49,6 +49,8 @@
.Fd #include <limits.h>
.Ft long
.Fn strtol "const char *nptr" "char **endptr" "int base"
+.Ft long long
+.Fn strtoll "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 a
.Em long
value.
The
+.Fn strtoll
+function
+converts the string in
+.Fa nptr
+to a
+.Em long long
+value.
+The
.Fn strtoq
function
converts the string in
@@ -145,7 +155,20 @@ If an overflow occurs,
.Fn strtol
returns
.Dv LONG_MAX .
-In both cases,
+The
+.Fn strtoll
+function
+returns the result of the conversion,
+unless the value would underflow or overflow.
+If an underflow occurs,
+.Fn strtoll
+returns
+.Dv LLONG_MIN .
+If an overflow occurs,
+.Fn strtoll
+returns
+.Dv LLONG_MAX .
+In all cases,
.Va errno
is set to
.Er ERANGE .
@@ -166,5 +189,13 @@ The
function
conforms to
.St -isoC .
+The
+.Fn strtoll
+function
+conforms to
+.St -isoC-99 .
+The BSD
+.Fn strtoq
+function is deprecated.
.Sh BUGS
Ignores the current locale.