Loading...
--- Libc/Libc-262/stdlib/atol.3
+++ Libc/Libc-763.12/stdlib/atol.3
@@ -13,10 +13,6 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
@@ -34,44 +30,133 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)atol.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/atol.3,v 1.6 2001/09/07 14:46:35 asmodai Exp $
+.\" $FreeBSD: src/lib/libc/stdlib/atol.3,v 1.16 2009/03/01 05:44:28 delphij Exp $
.\"
-.Dd June 4, 1993
+.Dd February 1, 2009
.Dt ATOL 3
.Os
.Sh NAME
-.Nm atol
+.Nm atol , atoll ,
+.Nm atol_l , atoll_l
.Nd convert
.Tn ASCII
-string to long integer
+string to
+.Vt long
+or
+.Vt "long long"
+integer
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In stdlib.h
.Ft long
-.Fn atol "const char *nptr"
+.Fn atol "const char *str"
+.Ft "long long"
+.Fn atoll "const char *str"
+.In xlocale.h
+.Ft long
+.Fn atol_l "const char *str" "locale_t loc"
+.Ft "long long"
+.Fn atoll_l "const char *str" "locale_t loc"
.Sh DESCRIPTION
The
.Fn atol
function converts the initial portion of the string pointed to by
-.Ar nptr
+.Fa str
to
-.Em long integer
+.Vt long
+integer
representation.
.Pp
It is equivalent to:
-.Bd -literal -offset indent
-strtol(nptr, (char **)NULL, 10);
-.Ed
+.Pp
+.Dl "strtol(str, (char **)NULL, 10);"
+.Pp
+The
+.Fn atoll
+function converts the initial portion of the string pointed to by
+.Fa str
+to
+.Vt "long long"
+integer
+representation.
+.Pp
+It is equivalent to:
+.Pp
+.Dl "strtoll(str, (char **)NULL, 10);"
+.Pp
+While the
+.Fn atol
+and
+.Fn atoll
+functions use the current locale, the
+.Fn atol_l
+and
+.Fn atoll_l
+functions may be passed locales directly. See
+.Xr xlocale 3
+for more information.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn atol ,
+.Fn atoll ,
+.Fn atol_l ,
+and
+.Fn atoll_l
+functions are thread-safe and async-cancel-safe.
+.Pp
+The
+.Fx
+implementations of the
+.Fn atol
+and
+.Fn atoll
+functions are thin wrappers around
+.Fn strtol
+and
+.Fn stroll
+respectively, so these functions will affect the value of
+.Va errno
+in the same way that the
+.Fn strtol
+and
+.Fn stroll
+functions are able to.
+This behavior of
+.Fn atol
+and
+.Fn atoll
+is not required by
+.St -isoC
+or
+.St -isoC-99 ,
+but it is allowed by all of
+.St -isoC , St -isoC-99
+and
+.St -p1003.1-2001 .
+.Sh ERRORS
+The functions
+.Fn atol
+and
+.Fn atoll
+may affect the value of
+.Va errno
+on an error.
.Sh SEE ALSO
.Xr atof 3 ,
.Xr atoi 3 ,
.Xr strtod 3 ,
.Xr strtol 3 ,
-.Xr strtoul 3
+.Xr strtoul 3 ,
+.Xr xlocale 3
.Sh STANDARDS
The
.Fn atol
function
conforms to
.St -isoC .
+The
+.Fn atoll
+function
+conforms to
+.St -isoC-99 .