diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libc/stdlib/strtol.3 | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/src/lib/libc/stdlib/strtol.3 b/src/lib/libc/stdlib/strtol.3 index df696b7b85..fdc02b20b8 100644 --- a/src/lib/libc/stdlib/strtol.3 +++ b/src/lib/libc/stdlib/strtol.3 | |||
| @@ -33,7 +33,7 @@ | |||
| 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.7 2000/03/04 22:19:31 aaron Exp $ | 36 | .\" $OpenBSD: strtol.3,v 1.8 2000/04/20 13:50:03 aaron Exp $ |
| 37 | .\" | 37 | .\" |
| 38 | .Dd June 25, 1992 | 38 | .Dd June 25, 1992 |
| 39 | .Dt STRTOL 3 | 39 | .Dt STRTOL 3 |
| @@ -46,7 +46,7 @@ | |||
| 46 | .Fd #include <limits.h> | 46 | .Fd #include <limits.h> |
| 47 | .Ft long | 47 | .Ft long |
| 48 | .Fn strtol "const char *nptr" "char **endptr" "int base" | 48 | .Fn strtol "const char *nptr" "char **endptr" "int base" |
| 49 | 49 | .Pp | |
| 50 | .Fd #include <sys/types.h> | 50 | .Fd #include <sys/types.h> |
| 51 | .Fd #include <stdlib.h> | 51 | .Fd #include <stdlib.h> |
| 52 | .Fd #include <limits.h> | 52 | .Fd #include <limits.h> |
| @@ -55,24 +55,21 @@ | |||
| 55 | .Sh DESCRIPTION | 55 | .Sh DESCRIPTION |
| 56 | The | 56 | The |
| 57 | .Fn strtol | 57 | .Fn strtol |
| 58 | function | 58 | function converts the string in |
| 59 | converts the string in | ||
| 60 | .Fa nptr | 59 | .Fa nptr |
| 61 | to a | 60 | to a |
| 62 | .Li long | 61 | .Li long |
| 63 | value. | 62 | value. |
| 64 | The | 63 | The |
| 65 | .Fn strtoq | 64 | .Fn strtoq |
| 66 | function | 65 | function converts the string in |
| 67 | converts the string in | ||
| 68 | .Fa nptr | 66 | .Fa nptr |
| 69 | to a | 67 | to a |
| 70 | .Li quad_t | 68 | .Li quad_t |
| 71 | value. | 69 | value. |
| 72 | The conversion is done according to the given | 70 | The conversion is done according to the given |
| 73 | .Fa base , | 71 | .Fa base , |
| 74 | which must be a number between 2 and 36 inclusive | 72 | which must be a number between 2 and 36 inclusive or the special value 0. |
| 75 | or the special value 0. | ||
| 76 | .Pp | 73 | .Pp |
| 77 | The string may begin with an arbitrary amount of whitespace | 74 | The string may begin with an arbitrary amount of whitespace |
| 78 | (as determined by | 75 | (as determined by |
| @@ -84,11 +81,9 @@ or | |||
| 84 | sign. | 81 | sign. |
| 85 | If | 82 | If |
| 86 | .Fa base | 83 | .Fa base |
| 87 | is zero or 16, | 84 | is zero or 16, the string may then include a |
| 88 | the string may then include a | ||
| 89 | .Ql 0x | 85 | .Ql 0x |
| 90 | prefix, | 86 | prefix, and the number will be read in base 16; otherwise, a zero |
| 91 | and the number will be read in base 16; otherwise, a zero | ||
| 92 | .Fa base | 87 | .Fa base |
| 93 | is taken as 10 (decimal) unless the next character is | 88 | is taken as 10 (decimal) unless the next character is |
| 94 | .Ql 0 , | 89 | .Ql 0 , |
| @@ -101,8 +96,7 @@ stopping at the first character which is not a valid digit | |||
| 101 | in the given base. | 96 | in the given base. |
| 102 | (In bases above 10, the letter | 97 | (In bases above 10, the letter |
| 103 | .Ql A | 98 | .Ql A |
| 104 | in either upper or lower case | 99 | in either upper or lower case represents 10, |
| 105 | represents 10, | ||
| 106 | .Ql B | 100 | .Ql B |
| 107 | represents 11, and so forth, with | 101 | represents 11, and so forth, with |
| 108 | .Ql Z | 102 | .Ql Z |
| @@ -110,7 +104,7 @@ representing 35.) | |||
| 110 | .Pp | 104 | .Pp |
| 111 | If | 105 | If |
| 112 | .Fa endptr | 106 | .Fa endptr |
| 113 | is non nil, | 107 | is non-null, |
| 114 | .Fn strtol | 108 | .Fn strtol |
| 115 | stores the address of the first invalid character in | 109 | stores the address of the first invalid character in |
| 116 | .Fa *endptr . | 110 | .Fa *endptr . |
| @@ -132,8 +126,7 @@ on return, the entire string was valid.) | |||
| 132 | .Sh RETURN VALUES | 126 | .Sh RETURN VALUES |
| 133 | The | 127 | The |
| 134 | .Fn strtol | 128 | .Fn strtol |
| 135 | function | 129 | function returns the result of the conversion, |
| 136 | returns the result of the conversion, | ||
| 137 | unless the value would underflow or overflow. | 130 | unless the value would underflow or overflow. |
| 138 | If an underflow occurs, | 131 | If an underflow occurs, |
| 139 | .Fn strtol | 132 | .Fn strtol |
| @@ -191,8 +184,8 @@ error checking is further complicated because the desired return value is an | |||
| 191 | .Li int | 184 | .Li int |
| 192 | rather than a | 185 | rather than a |
| 193 | .Li long ; | 186 | .Li long ; |
| 194 | however, on some architectures integers and long integers are the same | 187 | however, on some architectures integers and long integers are the same size. |
| 195 | size. Thus the following is necessary: | 188 | Thus the following is necessary: |
| 196 | .Bd -literal -offset indent | 189 | .Bd -literal -offset indent |
| 197 | char *ep; | 190 | char *ep; |
| 198 | int ival; | 191 | int ival; |
| @@ -224,8 +217,7 @@ The given string was out of range; the value converted has been clamped. | |||
| 224 | .Sh STANDARDS | 217 | .Sh STANDARDS |
| 225 | The | 218 | The |
| 226 | .Fn strtol | 219 | .Fn strtol |
| 227 | function | 220 | function conforms to |
| 228 | conforms to | ||
| 229 | .St -ansiC . | 221 | .St -ansiC . |
| 230 | .Sh BUGS | 222 | .Sh BUGS |
| 231 | Ignores the current locale. | 223 | Ignores the current locale. |
