]> git.saurik.com Git - apple/libc.git/blob - stdlib/FreeBSD/atoi.3.patch
a322d5920c740936b01ac6dd2ecaa05a6a10e452
[apple/libc.git] / stdlib / FreeBSD / atoi.3.patch
1 --- atoi.3.orig 2010-02-08 16:26:10.000000000 -0800
2 +++ atoi.3 2010-02-13 20:59:41.000000000 -0800
3 @@ -36,7 +36,8 @@
4 .Dt ATOI 3
5 .Os
6 .Sh NAME
7 -.Nm atoi
8 +.Nm atoi ,
9 +.Nm atoi_l
10 .Nd convert
11 .Tn ASCII
12 string to integer
13 @@ -45,25 +46,46 @@ string to integer
14 .Sh SYNOPSIS
15 .In stdlib.h
16 .Ft int
17 -.Fn atoi "const char *nptr"
18 +.Fn atoi "const char *str"
19 +.In xlocale.h
20 +.Ft int
21 +.Fn atoi_l "const char *str" "locale_t loc"
22 .Sh DESCRIPTION
23 The
24 .Fn atoi
25 function converts the initial portion of the string pointed to by
26 -.Fa nptr
27 +.Fa str
28 to
29 .Vt int
30 representation.
31 .Pp
32 It is equivalent to:
33 .Bd -literal -offset indent
34 -(int)strtol(nptr, (char **)NULL, 10);
35 +(int)strtol(str, (char **)NULL, 10);
36 .Ed
37 .Pp
38 +While the
39 +.Fn atoi
40 +function uses the current locale, the
41 +.Fn atoi_l
42 +function may be passed a locale directly. See
43 +.Xr xlocale 3
44 +for more information.
45 +.Sh IMPLEMENTATION NOTES
46 +The
47 +.Fn atoi
48 +and
49 +.Fn atoi_l
50 +functions are thread-safe and async-cancel-safe.
51 +.Pp
52 The
53 .Fn atoi
54 -function has been deprecated by
55 +and
56 +.Fn atoi_l
57 +functions have been deprecated by
58 .Fn strtol
59 +and
60 +.Fn strtol_l
61 and should not be used in new code.
62 .Sh ERRORS
63 The function
64 @@ -76,7 +98,8 @@ on an error.
65 .Xr atol 3 ,
66 .Xr strtod 3 ,
67 .Xr strtol 3 ,
68 -.Xr strtoul 3
69 +.Xr strtoul 3 ,
70 +.Xr xlocale 3
71 .Sh STANDARDS
72 The
73 .Fn atoi