summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2009-05-20 22:01:34 +0000
committerchristos <christos@NetBSD.org>2009-05-20 22:01:34 +0000
commitfd67370208ad4c2bb29e6de4e0e35f47989368e4 (patch)
tree540611d25b1018881b7488147c17cb97428af8d3 /lib/libc/stdlib
parent51a76d6f118400f4bc87d5cb438c095bbf00754b (diff)
mention that these functions return 0 and set errno to ERANGE on invalid base.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/strtol.321
-rw-r--r--lib/libc/stdlib/strtoul.321
2 files changed, 38 insertions, 4 deletions
diff --git a/lib/libc/stdlib/strtol.3 b/lib/libc/stdlib/strtol.3
index 2b486415603..2bf5c887984 100644
--- a/lib/libc/stdlib/strtol.3
+++ b/lib/libc/stdlib/strtol.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: strtol.3,v 1.22 2003/09/08 17:54:33 wiz Exp $
+.\" $NetBSD: strtol.3,v 1.23 2009/05/20 22:01:34 christos Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" from: @(#)strtol.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd August 11, 2002
+.Dd May 20, 2009
.Dt STRTOL 3
.Os
.Sh NAME
@@ -186,6 +186,14 @@ In these cases,
.Va errno
is set to
.Er ERANGE .
+If the
+.Fa base
+argument is not supported then
+.Va errno
+is set to
+.Er EINVAL
+and the functions return
+.Dv 0 .
.Sh EXAMPLES
Ensuring that a string is a valid number (i.e., in range and containing no
trailing characters) requires clearing
@@ -250,6 +258,15 @@ ival = lval;
.Ed
.Sh ERRORS
.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Ar base
+is not between
+.Dv 2
+and
+.Dv 36
+and does not contain the special value
+.Dv 0.
.It Bq Er ERANGE
The given string was out of range; the value converted has been clamped.
.El
diff --git a/lib/libc/stdlib/strtoul.3 b/lib/libc/stdlib/strtoul.3
index 55b34aa88e3..84cb6a8cb61 100644
--- a/lib/libc/stdlib/strtoul.3
+++ b/lib/libc/stdlib/strtoul.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: strtoul.3,v 1.19 2003/09/08 17:54:33 wiz Exp $
+.\" $NetBSD: strtoul.3,v 1.20 2009/05/20 22:01:34 christos Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" from: @(#)strtoul.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd August 11, 2002
+.Dd May 20, 2009
.Dt STRTOUL 3
.Os
.Sh NAME
@@ -184,6 +184,14 @@ has processed a negative number (and returned an unsigned value) short of
examining the string in
.Fa nptr
directly.
+If the
+.Fa base
+argument is not supported then
+.Va errno
+is set to
+.Er EINVAL
+and the functions return
+.Dv 0 .
.Sh EXAMPLES
Ensuring that a string is a valid number (i.e., in range and containing no
trailing characters) requires clearing
@@ -221,6 +229,15 @@ alternately, use
.Xr sscanf 3 .
.Sh ERRORS
.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Ar base
+is not between
+.Dv 2
+and
+.Dv 36
+and does not contain the special value
+.Dv 0.
.It Bq Er ERANGE
The given string was out of range; the value converted has been clamped.
.El