Module Name: src
Committed By: christos
Date: Wed May 20 22:01:34 UTC 2009
Modified Files:
src/lib/libc/stdlib: strtol.3 strtoul.3
Log Message:
mention that these functions return 0 and set errno to ERANGE on invalid base.
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/stdlib/strtol.3
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/stdlib/strtoul.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdlib/strtol.3
diff -u src/lib/libc/stdlib/strtol.3:1.22 src/lib/libc/stdlib/strtol.3:1.23
--- src/lib/libc/stdlib/strtol.3:1.22 Mon Sep 8 13:54:33 2003
+++ src/lib/libc/stdlib/strtol.3 Wed May 20 18:01:34 2009
@@ -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 @@
.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 @@
.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
Index: src/lib/libc/stdlib/strtoul.3
diff -u src/lib/libc/stdlib/strtoul.3:1.19 src/lib/libc/stdlib/strtoul.3:1.20
--- src/lib/libc/stdlib/strtoul.3:1.19 Mon Sep 8 13:54:33 2003
+++ src/lib/libc/stdlib/strtoul.3 Wed May 20 18:01:34 2009
@@ -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 @@
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 @@
.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