]>
Commit | Line | Data |
---|---|---|
224c7076 A |
1 | --- strtol.3 2006-02-14 14:41:58.000000000 -0800 |
2 | +++ strtol.3.edit 2006-08-09 13:42:57.000000000 -0700 | |
3 | @@ -40,7 +40,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 | @@ -49,26 +52,41 @@ | |
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 | @@ -76,7 +94,7 @@ | |
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 | @@ -84,7 +102,7 @@ | |
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 | @@ -92,7 +110,7 @@ | |
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 | @@ -147,11 +165,11 @@ | |
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 | @@ -159,11 +177,17 @@ | |
3d9156a7 A |
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 , | |
224c7076 A |
119 | .Fn strtoll , |
120 | -.Fn strtoimax | |
121 | +.Fn strtoimax , | |
122 | and | |
123 | .Fn strtoq | |
124 | functions | |
125 | @@ -181,8 +205,8 @@ | |
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 overflow" ".Sy underflow" | |
130 | -.It Sy Function Ta Sy overflow Ta Sy underflow | |
131 | +.Bl -column -offset indent ".Fn strtoimax" ".Dv INTMAX_MIN" ".Dv INTMAX_MAX" | |
132 | +.It Sy Function Ta Sy underflow Ta Sy overflow | |
133 | .It Fn strtol Ta Dv LONG_MIN Ta Dv LONG_MAX | |
134 | .It Fn strtoll Ta Dv LLONG_MIN Ta Dv LLONG_MAX | |
135 | .It Fn strtoimax Ta Dv INTMAX_MIN Ta Dv INTMAX_MAX | |
136 | @@ -199,13 +223,25 @@ | |
137 | .It Bq Er ERANGE | |
138 | The given string was out of range; the value converted has been clamped. | |
139 | .El | |
140 | +.Sh LEGACY SYNOPSIS | |
141 | +.Fd #include <stdlib.h> | |
142 | +.Fd #include <limits.h> | |
143 | +.Pp | |
144 | +.In limits.h | |
145 | +is necessary for the | |
146 | +.Fn strtol | |
147 | +and | |
148 | +.Fn strtoll | |
149 | +functions. | |
150 | .Sh SEE ALSO | |
151 | .Xr atof 3 , | |
152 | .Xr atoi 3 , | |
3d9156a7 A |
153 | .Xr atol 3 , |
154 | .Xr strtod 3 , | |
224c7076 | 155 | +.Xr strtol_l 3 , |
3d9156a7 A |
156 | .Xr strtoul 3 , |
157 | -.Xr wcstol 3 | |
158 | +.Xr wcstol 3 , | |
224c7076 | 159 | +.Xr compat 5 |
3d9156a7 A |
160 | .Sh STANDARDS |
161 | The | |
162 | .Fn strtol |