]> git.saurik.com Git - apple/libc.git/blob - stdlib/FreeBSD/strtol.3.patch
Libc-763.12.tar.gz
[apple/libc.git] / stdlib / FreeBSD / strtol.3.patch
1 --- strtol.3.bsdnew 2009-11-13 14:11:51.000000000 -0800
2 +++ strtol.3 2009-11-13 14:33:25.000000000 -0800
3 @@ -36,7 +36,10 @@
4 .Dt STRTOL 3
5 .Os
6 .Sh NAME
7 -.Nm strtol , strtoll , strtoimax , strtoq
8 +.Nm strtoimax ,
9 +.Nm strtol ,
10 +.Nm strtoll ,
11 +.Nm strtoq
12 .Nd "convert a string value to a"
13 .Vt long , "long long" , intmax_t
14 or
15 @@ -45,26 +48,41 @@ integer
16 .Sh LIBRARY
17 .Lb libc
18 .Sh SYNOPSIS
19 +.In inttypes.h
20 +.Ft intmax_t
21 +.Fo strtoimax
22 +.Fa "const char *restrict str"
23 +.Fa "char **restrict endptr"
24 +.Fa "int base"
25 +.Fc
26 .In stdlib.h
27 -.In limits.h
28 .Ft long
29 -.Fn strtol "const char * restrict nptr" "char ** restrict endptr" "int base"
30 +.Fo strtol
31 +.Fa "const char *restrict str"
32 +.Fa "char **restrict endptr"
33 +.Fa "int base"
34 +.Fc
35 .Ft long long
36 -.Fn strtoll "const char * restrict nptr" "char ** restrict endptr" "int base"
37 -.In inttypes.h
38 -.Ft intmax_t
39 -.Fn strtoimax "const char * restrict nptr" "char ** restrict endptr" "int base"
40 +.Fo strtoll
41 +.Fa "const char *restrict str"
42 +.Fa "char **restrict endptr"
43 +.Fa "int base"
44 +.Fc
45 .In sys/types.h
46 .In stdlib.h
47 .In limits.h
48 .Ft quad_t
49 -.Fn strtoq "const char *nptr" "char **endptr" "int base"
50 +.Fo strtoq
51 +.Fa "const char *str"
52 +.Fa "char **endptr"
53 +.Fa "int base"
54 +.Fc
55 .Sh DESCRIPTION
56 The
57 .Fn strtol
58 function
59 converts the string in
60 -.Fa nptr
61 +.Fa str
62 to a
63 .Vt long
64 value.
65 @@ -72,7 +90,7 @@ The
66 .Fn strtoll
67 function
68 converts the string in
69 -.Fa nptr
70 +.Fa str
71 to a
72 .Vt "long long"
73 value.
74 @@ -80,7 +98,7 @@ The
75 .Fn strtoimax
76 function
77 converts the string in
78 -.Fa nptr
79 +.Fa str
80 to an
81 .Vt intmax_t
82 value.
83 @@ -88,7 +106,7 @@ The
84 .Fn strtoq
85 function
86 converts the string in
87 -.Fa nptr
88 +.Fa str
89 to a
90 .Vt quad_t
91 value.
92 @@ -143,11 +161,11 @@ stores the address of the first invalid
93 If there were no digits at all, however,
94 .Fn strtol
95 stores the original value of
96 -.Fa nptr
97 +.Fa str
98 in
99 .Fa *endptr .
100 (Thus, if
101 -.Fa *nptr
102 +.Fa *str
103 is not
104 .Ql \e0
105 but
106 @@ -155,11 +173,17 @@ but
107 is
108 .Ql \e0
109 on return, the entire string was valid.)
110 +.Pp
111 +Extended locale versions of these functions are documented in
112 +.Xr strtol_l 3 .
113 +See
114 +.Xr xlocale 3
115 +for more information.
116 .Sh RETURN VALUES
117 The
118 .Fn strtol ,
119 .Fn strtoll ,
120 -.Fn strtoimax
121 +.Fn strtoimax ,
122 and
123 .Fn strtoq
124 functions
125 @@ -177,7 +201,7 @@ is set to
126 .Er ERANGE
127 and the function return value is clamped according
128 to the following table.
129 -.Bl -column -offset indent ".Fn strtoimax" ".Sy underflow" ".Sy overflow"
130 +.Bl -column -offset indent ".Fn strtoimax" ".Dv INTMAX_MIN" ".Dv INTMAX_MAX"
131 .It Sy Function Ta Sy underflow Ta Sy overflow
132 .It Fn strtol Ta Dv LONG_MIN Ta Dv LONG_MAX
133 .It Fn strtoll Ta Dv LLONG_MIN Ta Dv LLONG_MAX
134 @@ -195,14 +219,25 @@ no conversion could be performed
135 .It Bq Er ERANGE
136 The given string was out of range; the value converted has been clamped.
137 .El
138 +.Sh LEGACY SYNOPSIS
139 +.Fd #include <stdlib.h>
140 +.Fd #include <limits.h>
141 +.Pp
142 +.In limits.h
143 +is necessary for the
144 +.Fn strtol
145 +and
146 +.Fn strtoll
147 +functions.
148 .Sh SEE ALSO
149 .Xr atof 3 ,
150 .Xr atoi 3 ,
151 .Xr atol 3 ,
152 .Xr strtod 3 ,
153 -.Xr strtonum 3 ,
154 +.Xr strtol_l 3 ,
155 .Xr strtoul 3 ,
156 -.Xr wcstol 3
157 +.Xr wcstol 3 ,
158 +.Xr compat 5
159 .Sh STANDARDS
160 The
161 .Fn strtol