Markup improvements. No need to mark up numbers as defined values, math

did the definition for us ages ago. Make HTML-ready.
This commit is contained in:
wiz 2009-05-21 09:13:35 +00:00
parent 42d3e7ca09
commit f6b43a0c43
2 changed files with 27 additions and 39 deletions

View File

@ -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

View File

@ -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