mention that these functions return 0 and set errno to ERANGE on invalid base.

This commit is contained in:
christos 2009-05-20 22:01:34 +00:00
parent 51a76d6f11
commit fd67370208
2 changed files with 38 additions and 4 deletions

View File

@ -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

View File

@ -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