diff options
Diffstat (limited to 'src/lib/libc/stdlib/strtol.3')
-rw-r--r-- | src/lib/libc/stdlib/strtol.3 | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/lib/libc/stdlib/strtol.3 b/src/lib/libc/stdlib/strtol.3 index afdb84f19b..a5bdff0b81 100644 --- a/src/lib/libc/stdlib/strtol.3 +++ b/src/lib/libc/stdlib/strtol.3 | |||
@@ -33,21 +33,27 @@ | |||
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" $OpenBSD: strtol.3,v 1.9 2000/08/09 15:51:21 aaron Exp $ | 36 | .\" $OpenBSD: strtol.3,v 1.10 2002/06/29 00:20:11 millert Exp $ |
37 | .\" | 37 | .\" |
38 | .Dd June 25, 1992 | 38 | .Dd June 25, 1992 |
39 | .Dt STRTOL 3 | 39 | .Dt STRTOL 3 |
40 | .Os | 40 | .Os |
41 | .Sh NAME | 41 | .Sh NAME |
42 | .Nm strtol , | 42 | .Nm strtol , |
43 | .Nm strtoll , | ||
43 | .Nm strtoq | 44 | .Nm strtoq |
44 | .Nd convert string value to a long or quad_t integer | 45 | .Nd convert string value to a long or long long integer |
45 | .Sh SYNOPSIS | 46 | .Sh SYNOPSIS |
46 | .Fd #include <stdlib.h> | 47 | .Fd #include <stdlib.h> |
47 | .Fd #include <limits.h> | 48 | .Fd #include <limits.h> |
48 | .Ft long | 49 | .Ft long |
49 | .Fn strtol "const char *nptr" "char **endptr" "int base" | 50 | .Fn strtol "const char *nptr" "char **endptr" "int base" |
50 | .Pp | 51 | .Pp |
52 | .Fd #include <stdlib.h> | ||
53 | .Fd #include <limits.h> | ||
54 | .Ft long long | ||
55 | .Fn strtoll "const char *nptr" "char **endptr" "int base" | ||
56 | .Pp | ||
51 | .Fd #include <sys/types.h> | 57 | .Fd #include <sys/types.h> |
52 | .Fd #include <stdlib.h> | 58 | .Fd #include <stdlib.h> |
53 | .Fd #include <limits.h> | 59 | .Fd #include <limits.h> |
@@ -62,12 +68,17 @@ to a | |||
62 | .Li long | 68 | .Li long |
63 | value. | 69 | value. |
64 | The | 70 | The |
65 | .Fn strtoq | 71 | .Fn strtoll |
66 | function converts the string in | 72 | function converts the string in |
67 | .Fa nptr | 73 | .Fa nptr |
68 | to a | 74 | to a |
69 | .Li quad_t | 75 | .Li long long |
70 | value. | 76 | value. |
77 | The | ||
78 | .Fn strtoq | ||
79 | function is a deprecated equivalent of | ||
80 | .Fn strtoll | ||
81 | and is provided for backwards compatibility with legacy programs. | ||
71 | The conversion is done according to the given | 82 | The conversion is done according to the given |
72 | .Fa base , | 83 | .Fa base , |
73 | which must be a number between 2 and 36 inclusive or the special value 0. | 84 | which must be a number between 2 and 36 inclusive or the special value 0. |
@@ -141,6 +152,14 @@ In both cases, | |||
141 | .Va errno | 152 | .Va errno |
142 | is set to | 153 | is set to |
143 | .Er ERANGE . | 154 | .Er ERANGE . |
155 | .Pp | ||
156 | The | ||
157 | .Fn strtoll | ||
158 | function has identical return values except that | ||
159 | .Dv LLONG_MIN | ||
160 | and | ||
161 | .Dv LLONG_MAX | ||
162 | are used to indicate underflow and overflow respectively. | ||
144 | .Sh EXAMPLES | 163 | .Sh EXAMPLES |
145 | Ensuring that a string is a valid number (i.e., in range and containing no | 164 | Ensuring that a string is a valid number (i.e., in range and containing no |
146 | trailing characters) requires clearing | 165 | trailing characters) requires clearing |