diff options
| author | wiz <wiz@NetBSD.org> | 2009-05-21 09:13:35 +0000 |
|---|---|---|
| committer | wiz <wiz@NetBSD.org> | 2009-05-21 09:13:35 +0000 |
| commit | f6b43a0c43e71dddbb469b85d6fd14d2eaa11e51 (patch) | |
| tree | f9cbb4f371fb792eef1765ed32f3af4e9fb7b99c /lib/libc/stdlib | |
| parent | 42d3e7ca0926fd5d919f511d4aa007942d4cfee0 (diff) | |
Markup improvements. No need to mark up numbers as defined values, math
did the definition for us ages ago. Make HTML-ready.
Diffstat (limited to 'lib/libc/stdlib')
| -rw-r--r-- | lib/libc/stdlib/strtol.3 | 36 | ||||
| -rw-r--r-- | lib/libc/stdlib/strtoul.3 | 30 |
2 files changed, 27 insertions, 39 deletions
diff --git a/lib/libc/stdlib/strtol.3 b/lib/libc/stdlib/strtol.3 index 2bf5c887984..849181e9215 100644 --- a/lib/libc/stdlib/strtol.3 +++ b/lib/libc/stdlib/strtol.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: strtol.3,v 1.23 2009/05/20 22:01:34 christos Exp $ +.\" $NetBSD: strtol.3,v 1.24 2009/05/21 09:13:35 wiz Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -41,7 +41,7 @@ .Nm strtoll , .Nm strtoimax , .Nm strtoq -.Nd "convert string value to a long, long long, intmax_t or quad_t integer" +.Nd convert string value to a long, long long, intmax_t or quad_t integer .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -68,7 +68,7 @@ function converts the string in .Fa nptr to a -.Em long int +.Ft long int value. The .Fn strtoll @@ -76,7 +76,7 @@ function converts the string in .Fa nptr to a -.Em long long int +.Ft long long int value. The .Fn strtoimax @@ -84,7 +84,7 @@ function converts the string in .Fa nptr to an -.Em intmax_t +.Ft intmax_t value. The .Fn strtoq @@ -92,7 +92,7 @@ function converts the string in .Fa nptr to a -.Em quad_t +.Ft quad_t value. The conversion is done according to the given .Fa base , @@ -135,7 +135,7 @@ representing 35.) .Pp If .Fa endptr -is non nil, +is non-nil, .Fn strtol stores the address of the first invalid character in .Fa *endptr . @@ -192,8 +192,7 @@ argument is not supported then .Va errno is set to .Er EINVAL -and the functions return -.Dv 0 . +and the functions return 0. .Sh EXAMPLES Ensuring that a string is a valid number (i.e., in range and containing no trailing characters) requires clearing @@ -212,10 +211,10 @@ long lval; \&... errno = 0; -lval = strtol(buf, &ep, 10); +lval = strtol(buf, \*[Am]ep, 10); if (buf[0] == '\e0' || *ep != '\e0') goto not_a_number; -if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN)) +if (errno == ERANGE \*[Am]\*[Am] (lval == LONG_MAX || lval == LONG_MIN)) goto out_of_range; .Ed .Pp @@ -248,25 +247,20 @@ long lval; \&... errno = 0; -lval = strtol(buf, &ep, 10); +lval = strtol(buf, \*[Am]ep, 10); if (buf[0] == '\e0' || *ep != '\e0') goto not_a_number; -if ((errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN)) || - (lval > INT_MAX || lval < INT_MIN)) +if ((errno == ERANGE \*[Am]\*[Am] (lval == LONG_MAX || lval == LONG_MIN)) || + (lval \*[Gt] INT_MAX || lval \*[Lt] INT_MIN)) goto out_of_range; ival = lval; .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er EINVAL -The +The .Ar base -is not between -.Dv 2 -and -.Dv 36 -and does not contain the special value -.Dv 0. +is not between 2 and 36 and does not contain the special value 0. .It Bq Er ERANGE The given string was out of range; the value converted has been clamped. .El diff --git a/lib/libc/stdlib/strtoul.3 b/lib/libc/stdlib/strtoul.3 index 84cb6a8cb61..95469ecc032 100644 --- a/lib/libc/stdlib/strtoul.3 +++ b/lib/libc/stdlib/strtoul.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: strtoul.3,v 1.20 2009/05/20 22:01:34 christos Exp $ +.\" $NetBSD: strtoul.3,v 1.21 2009/05/21 09:13:35 wiz Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -41,7 +41,7 @@ .Nm strtoull , .Nm strtoumax , .Nm strtouq -.Nd "convert a string to an unsigned long, unsigned long long, uintmax_t or uquad_t integer" +.Nd convert a string to an unsigned long, unsigned long long, uintmax_t or uquad_t integer .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -68,7 +68,7 @@ function converts the string in .Fa nptr to an -.Em unsigned long int +.Ft unsigned long int value. The .Fn strtoull @@ -76,7 +76,7 @@ function converts the string in .Fa nptr to an -.Em unsigned long long int +.Ft unsigned long long int value. The .Fn strtoumax @@ -84,7 +84,7 @@ function converts the string in .Fa nptr to an -.Em uintmax_t +.Ft uintmax_t value. The .Fn strtouq @@ -92,7 +92,7 @@ function converts the string in .Fa nptr to a -.Em u_quad_t +.Ft u_quad_t value. The conversion is done according to the given .Fa base , @@ -136,7 +136,7 @@ representing 35.) .Pp If .Fa endptr -is non nil, +is non-nil, .Fn strtoul stores the address of the first invalid character in .Fa *endptr . @@ -190,8 +190,7 @@ argument is not supported then .Va errno is set to .Er EINVAL -and the functions return -.Dv 0 . +and the functions return 0. .Sh EXAMPLES Ensuring that a string is a valid number (i.e., in range and containing no trailing characters) requires clearing @@ -210,10 +209,10 @@ unsigned long ulval; \&... errno = 0; -ulval = strtoul(buf, &ep, 10); +ulval = strtoul(buf, \*[Am]ep, 10); if (buf[0] == '\e0' || *ep != '\e0') goto not_a_number; -if (errno == ERANGE && ulval == ULONG_MAX) +if (errno == ERANGE \*[Am]\*[Am] ulval == ULONG_MAX) goto out_of_range; .Ed .Pp @@ -230,14 +229,9 @@ alternately, use .Sh ERRORS .Bl -tag -width Er .It Bq Er EINVAL -The +The .Ar base -is not between -.Dv 2 -and -.Dv 36 -and does not contain the special value -.Dv 0. +is not between 2 and 36 and does not contain the special value 0. .It Bq Er ERANGE The given string was out of range; the value converted has been clamped. .El |
