]>
Commit | Line | Data |
---|---|---|
1f2f436a A |
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 @@ | |
3d9156a7 A |
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 | |
1f2f436a | 13 | @@ -45,25 +46,46 @@ string to integer |
224c7076 | 14 | .Sh SYNOPSIS |
3d9156a7 A |
15 | .In stdlib.h |
16 | .Ft int | |
224c7076 A |
17 | -.Fn atoi "const char *nptr" |
18 | +.Fn atoi "const char *str" | |
3d9156a7 A |
19 | +.In xlocale.h |
20 | +.Ft int | |
224c7076 | 21 | +.Fn atoi_l "const char *str" "locale_t loc" |
3d9156a7 A |
22 | .Sh DESCRIPTION |
23 | The | |
24 | .Fn atoi | |
224c7076 A |
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: | |
3d9156a7 | 33 | .Bd -literal -offset indent |
224c7076 A |
34 | -(int)strtol(nptr, (char **)NULL, 10); |
35 | +(int)strtol(str, (char **)NULL, 10); | |
3d9156a7 | 36 | .Ed |
1f2f436a | 37 | .Pp |
3d9156a7 A |
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. | |
1f2f436a A |
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 | |
3d9156a7 A |
52 | The |
53 | .Fn atoi | |
1f2f436a A |
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. | |
3d9156a7 A |
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 |