Module Name: src
Committed By: wiz
Date: Thu May 21 09:13:35 UTC 2009
Modified Files:
src/lib/libc/stdlib: strtol.3 strtoul.3
Log Message:
Markup improvements. No need to mark up numbers as defined values, math
did the definition for us ages ago. Make HTML-ready.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/stdlib/strtol.3
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/stdlib/strtoul.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdlib/strtol.3
diff -u src/lib/libc/stdlib/strtol.3:1.23 src/lib/libc/stdlib/strtol.3:1.24
--- src/lib/libc/stdlib/strtol.3:1.23 Wed May 20 22:01:34 2009
+++ src/lib/libc/stdlib/strtol.3 Thu May 21 09:13:35 2009
@@ -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 @@
converts the string in
.Fa nptr
to a
-.Em long int
+.Ft long int
value.
The
.Fn strtoll
@@ -76,7 +76,7 @@
converts the string in
.Fa nptr
to a
-.Em long long int
+.Ft long long int
value.
The
.Fn strtoimax
@@ -84,7 +84,7 @@
converts the string in
.Fa nptr
to an
-.Em intmax_t
+.Ft intmax_t
value.
The
.Fn strtoq
@@ -92,7 +92,7 @@
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 @@
.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 @@
.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 @@
\&...
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 @@
\&...
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
Index: src/lib/libc/stdlib/strtoul.3
diff -u src/lib/libc/stdlib/strtoul.3:1.20 src/lib/libc/stdlib/strtoul.3:1.21
--- src/lib/libc/stdlib/strtoul.3:1.20 Wed May 20 22:01:34 2009
+++ src/lib/libc/stdlib/strtoul.3 Thu May 21 09:13:35 2009
@@ -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 @@
converts the string in
.Fa nptr
to an
-.Em unsigned long int
+.Ft unsigned long int
value.
The
.Fn strtoull
@@ -76,7 +76,7 @@
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 @@
converts the string in
.Fa nptr
to an
-.Em uintmax_t
+.Ft uintmax_t
value.
The
.Fn strtouq
@@ -92,7 +92,7 @@
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 @@
.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 @@
.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 @@
\&...
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 @@
.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