summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraaron <>1999-06-29 18:36:24 +0000
committeraaron <>1999-06-29 18:36:24 +0000
commit5771e6280ed94b6457e5db9facb5899254e4fb7f (patch)
tree95397a7ed19a0cddf5a2ebb73dee20cf20fe2c29
parent403f5844d16c63a63b8ce33a354e4871cb93df4c (diff)
downloadopenbsd-5771e6280ed94b6457e5db9facb5899254e4fb7f.tar.gz
openbsd-5771e6280ed94b6457e5db9facb5899254e4fb7f.tar.bz2
openbsd-5771e6280ed94b6457e5db9facb5899254e4fb7f.zip
first round of repairs on stdlib
-rw-r--r--src/lib/libc/stdlib/a64l.359
-rw-r--r--src/lib/libc/stdlib/abort.34
-rw-r--r--src/lib/libc/stdlib/abs.34
-rw-r--r--src/lib/libc/stdlib/alloca.36
-rw-r--r--src/lib/libc/stdlib/atexit.36
-rw-r--r--src/lib/libc/stdlib/atof.36
-rw-r--r--src/lib/libc/stdlib/atoi.36
-rw-r--r--src/lib/libc/stdlib/atol.36
-rw-r--r--src/lib/libc/stdlib/bsearch.36
-rw-r--r--src/lib/libc/stdlib/calloc.34
-rw-r--r--src/lib/libc/stdlib/div.36
-rw-r--r--src/lib/libc/stdlib/getenv.330
-rw-r--r--src/lib/libc/stdlib/getopt.323
-rw-r--r--src/lib/libc/stdlib/getsubopt.35
-rw-r--r--src/lib/libc/stdlib/labs.34
-rw-r--r--src/lib/libc/stdlib/ldiv.312
-rw-r--r--src/lib/libc/stdlib/malloc.327
-rw-r--r--src/lib/libc/stdlib/qabs.34
-rw-r--r--src/lib/libc/stdlib/qdiv.312
-rw-r--r--src/lib/libc/stdlib/qsort.34
-rw-r--r--src/lib/libc/stdlib/radixsort.311
-rw-r--r--src/lib/libc/stdlib/rand.34
-rw-r--r--src/lib/libc/stdlib/rand48.34
-rw-r--r--src/lib/libc/stdlib/random.314
-rw-r--r--src/lib/libc/stdlib/realpath.34
-rw-r--r--src/lib/libc/stdlib/strtod.38
-rw-r--r--src/lib/libc/stdlib/strtol.38
-rw-r--r--src/lib/libc/stdlib/strtoul.38
-rw-r--r--src/lib/libc/stdlib/system.316
-rw-r--r--src/lib/libc/stdlib/tsearch.321
30 files changed, 182 insertions, 150 deletions
diff --git a/src/lib/libc/stdlib/a64l.3 b/src/lib/libc/stdlib/a64l.3
index 0607338cba..1074dbff2e 100644
--- a/src/lib/libc/stdlib/a64l.3
+++ b/src/lib/libc/stdlib/a64l.3
@@ -24,7 +24,7 @@
24.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\" 26.\"
27.\" $OpenBSD: a64l.3,v 1.3 1999/02/27 21:55:53 deraadt Exp $ 27.\" $OpenBSD: a64l.3,v 1.4 1999/06/29 18:36:15 aaron Exp $
28.\" 28.\"
29.Dd August 17, 1997 29.Dd August 17, 1997
30.Dt A64L 3 30.Dt A64L 3
@@ -45,19 +45,36 @@ The
45and 45and
46.Fn l64a 46.Fn l64a
47functions are used to maintain numbers stored in radix-64 47functions are used to maintain numbers stored in radix-64
48ASCII characters. This is a notation by which 32-bit integers 48.Tn ASCII
49characters. This is a notation by which 32-bit integers
49can be represented by up to six characters; each character 50can be represented by up to six characters; each character
50represents a "digit" in a radix-64 notation. 51represents a
52.Dq digit
53in a radix-64 notation.
51.Pp 54.Pp
52The characters used to represent "digits" are '.' for 0, '/' for 1, 55The characters used to represent digits are
53'0' through '9' for 2-11, 'A' through 'Z' for 12-37, and 'a' through 56.Ql \&.
54'z' for 38-63. 57for 0,
58.Ql /
59for 1,
60.Ql 0
61through
62.Ql 9
63for 2-11,
64.Ql A
65through
66.Ql Z
67for 12-37, and
68.Ql a
69through
70.Ql z
71for 38-63.
55.Pp 72.Pp
56The 73The
57.Fn a64l 74.Fn a64l
58function takes a pointer to a null-terminated radix-64 representation 75function takes a pointer to a null-terminated radix-64 representation
59and returns a corresponding 32-bit value. If the string pointed to by 76and returns a corresponding 32-bit value. If the string pointed to by
60.Ar s 77.Fa s
61contains more than six characters, 78contains more than six characters,
62.Fn a64l 79.Fn a64l
63will use the first six. 80will use the first six.
@@ -68,35 +85,39 @@ larger than 32 bits, the return value will be sign-extended.
68.Pp 85.Pp
69.Fn l64a 86.Fn l64a
70takes a long integer argument 87takes a long integer argument
71.Ar l 88.Fa l
72and returns a pointer to the corresponding radix-64 representation. 89and returns a pointer to the corresponding radix-64 representation.
73.Sh RETURN VALUES 90.Sh RETURN VALUES
74On success, 91On success,
75.Fn a64l 92.Fn a64l
76returns a 32-bit representation of 93returns a 32-bit representation of
77.Ar s . 94.Fa s .
78If 95If
79.Ar s 96.Fa s
80is a NULL pointer or if it contains "digits" other than those described above, 97is a null pointer or if it contains digits other than those described above.
81.Fn a64l 98.Fn a64l
82returns -1L and sets the global variable errno to 99returns \-1 and sets the global variable
83.Va EINVAL . 100.Va errno
101to
102.Er EINVAL .
84.Pp 103.Pp
85On success, 104On success,
86.Fn l64a 105.Fn l64a
87returns a pointer to a string containing the radix-64 representation of 106returns a pointer to a string containing the radix-64 representation of
88.Ar l . 107.Fa l .
89If 108If
90.Ar l 109.Fa l
91is 0, 110is 0,
92.Fn l64a 111.Fn l64a
93returns a pointer to the empty string. 112returns a pointer to the empty string.
94If 113If
95.Ar l 114.Fa l
96is negative, 115is negative,
97.Fn l64a 116.Fn l64a
98returns a NULL pointer and sets the global variable errno to 117returns a null pointer and sets the global variable
99.Va EINVAL . 118.Va errno
119to
120.Er EINVAL .
100.Sh WARNINGS 121.Sh WARNINGS
101The value returned by 122The value returned by
102.Fn l64a 123.Fn l64a
@@ -115,7 +136,7 @@ If a long integer is larger than 32 bits, only the low-order
11532 bits are used. 13632 bits are used.
116.Sh STANDARDS 137.Sh STANDARDS
117The 138The
118.Fn a64l 139.Fn a64l
119and 140and
120.Fn l64a 141.Fn l64a
121functions conform to 142functions conform to
diff --git a/src/lib/libc/stdlib/abort.3 b/src/lib/libc/stdlib/abort.3
index 92c9a354d0..a0dfba7e80 100644
--- a/src/lib/libc/stdlib/abort.3
+++ b/src/lib/libc/stdlib/abort.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: abort.3,v 1.4 1997/07/17 07:39:41 deraadt Exp $ 36.\" $OpenBSD: abort.3,v 1.5 1999/06/29 18:36:17 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt ABORT 3 39.Dt ABORT 3
@@ -56,7 +56,7 @@ is being caught and the signal handler does not return.
56Any open streams are flushed and closed. 56Any open streams are flushed and closed.
57.Sh RETURN VALUES 57.Sh RETURN VALUES
58The 58The
59.Nm abort 59.Fn abort
60function 60function
61never returns. 61never returns.
62.Sh SEE ALSO 62.Sh SEE ALSO
diff --git a/src/lib/libc/stdlib/abs.3 b/src/lib/libc/stdlib/abs.3
index ca203c4e60..1e3675d7b5 100644
--- a/src/lib/libc/stdlib/abs.3
+++ b/src/lib/libc/stdlib/abs.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: abs.3,v 1.3 1999/05/16 19:55:12 alex Exp $ 36.\" $OpenBSD: abs.3,v 1.4 1999/06/29 18:36:17 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt ABS 3 39.Dt ABS 3
@@ -51,7 +51,7 @@ The
51function 51function
52computes 52computes
53the absolute value of the integer 53the absolute value of the integer
54.Ar j . 54.Fa j .
55.Sh RETURN VALUES 55.Sh RETURN VALUES
56The 56The
57.Fn abs 57.Fn abs
diff --git a/src/lib/libc/stdlib/alloca.3 b/src/lib/libc/stdlib/alloca.3
index 2b64dcfc08..56d52ebe1b 100644
--- a/src/lib/libc/stdlib/alloca.3
+++ b/src/lib/libc/stdlib/alloca.3
@@ -29,7 +29,7 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: alloca.3,v 1.6 1999/05/23 14:11:03 aaron Exp $ 32.\" $OpenBSD: alloca.3,v 1.7 1999/06/29 18:36:18 aaron Exp $
33.\" 33.\"
34.Dd May 2, 1991 34.Dd May 2, 1991
35.Dt ALLOCA 3 35.Dt ALLOCA 3
@@ -45,7 +45,7 @@
45The 45The
46.Fn alloca 46.Fn alloca
47function 47function
48allocates 48allocates
49.Fa size 49.Fa size
50bytes of space in the stack frame of the caller. 50bytes of space in the stack frame of the caller.
51This temporary space is automatically freed on 51This temporary space is automatically freed on
@@ -70,6 +70,6 @@ is machine dependent; its use is discouraged.
70.\" .Fn alloca 70.\" .Fn alloca
71.\" function appeared in 71.\" function appeared in
72.\" .Bx ?? . 72.\" .Bx ?? .
73.\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd 73.\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd
74.\" The first man page (or link to a man page that I can find at the 74.\" The first man page (or link to a man page that I can find at the
75.\" moment is 4.3... 75.\" moment is 4.3...
diff --git a/src/lib/libc/stdlib/atexit.3 b/src/lib/libc/stdlib/atexit.3
index 0b10f010fa..cc37d08b00 100644
--- a/src/lib/libc/stdlib/atexit.3
+++ b/src/lib/libc/stdlib/atexit.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: atexit.3,v 1.2 1996/08/19 08:33:22 tholo Exp $ 36.\" $OpenBSD: atexit.3,v 1.3 1999/06/29 18:36:18 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt ATEXIT 3 39.Dt ATEXIT 3
@@ -50,11 +50,11 @@ The
50.Fn atexit 50.Fn atexit
51function 51function
52registers the given 52registers the given
53.Ar function 53.Fa function
54to be called at program exit, whether via 54to be called at program exit, whether via
55.Xr exit 3 55.Xr exit 3
56or via return from the program's 56or via return from the program's
57.Em main . 57.Fn main .
58Functions so registered are called in reverse order; 58Functions so registered are called in reverse order;
59no arguments are passed. 59no arguments are passed.
60At least 32 functions can always be registered, 60At least 32 functions can always be registered,
diff --git a/src/lib/libc/stdlib/atof.3 b/src/lib/libc/stdlib/atof.3
index cc1b500b0f..0bd85dbe82 100644
--- a/src/lib/libc/stdlib/atof.3
+++ b/src/lib/libc/stdlib/atof.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: atof.3,v 1.2 1996/08/19 08:33:23 tholo Exp $ 36.\" $OpenBSD: atof.3,v 1.3 1999/06/29 18:36:18 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt ATOF 3 39.Dt ATOF 3
@@ -51,9 +51,9 @@ string to double
51The 51The
52.Fn atof 52.Fn atof
53function converts the initial portion of the string pointed to by 53function converts the initial portion of the string pointed to by
54.Ar nptr 54.Fa nptr
55to 55to
56.Ar double 56.Li double
57representation. 57representation.
58.Pp 58.Pp
59It is equivalent to: 59It is equivalent to:
diff --git a/src/lib/libc/stdlib/atoi.3 b/src/lib/libc/stdlib/atoi.3
index 280a989e8e..fa7b84e95c 100644
--- a/src/lib/libc/stdlib/atoi.3
+++ b/src/lib/libc/stdlib/atoi.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: atoi.3,v 1.2 1996/08/10 04:51:31 tholo Exp $ 36.\" $OpenBSD: atoi.3,v 1.3 1999/06/29 18:36:18 aaron Exp $
37.\" 37.\"
38.Dd June 4, 1993 38.Dd June 4, 1993
39.Dt ATOI 3 39.Dt ATOI 3
@@ -51,9 +51,9 @@ string to integer
51The 51The
52.Fn atoi 52.Fn atoi
53function converts the initial portion of the string pointed to by 53function converts the initial portion of the string pointed to by
54.Em nptr 54.Fa nptr
55to 55to
56.Em integer 56.Li integer
57representation. 57representation.
58.Pp 58.Pp
59It is equivalent to: 59It is equivalent to:
diff --git a/src/lib/libc/stdlib/atol.3 b/src/lib/libc/stdlib/atol.3
index 2b49bd1f2c..c7b4ff30da 100644
--- a/src/lib/libc/stdlib/atol.3
+++ b/src/lib/libc/stdlib/atol.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: atol.3,v 1.2 1996/08/19 08:33:25 tholo Exp $ 36.\" $OpenBSD: atol.3,v 1.3 1999/06/29 18:36:19 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt ATOL 3 39.Dt ATOL 3
@@ -51,9 +51,9 @@ string to long integer
51The 51The
52.Fn atol 52.Fn atol
53function converts the initial portion of the string pointed to by 53function converts the initial portion of the string pointed to by
54.Ar nptr 54.Fa nptr
55to 55to
56.Em long integer 56.Li long integer
57representation. 57representation.
58.Pp 58.Pp
59It is equivalent to: 59It is equivalent to:
diff --git a/src/lib/libc/stdlib/bsearch.3 b/src/lib/libc/stdlib/bsearch.3
index 570a4227b4..63d4e6af69 100644
--- a/src/lib/libc/stdlib/bsearch.3
+++ b/src/lib/libc/stdlib/bsearch.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: bsearch.3,v 1.3 1997/06/13 23:41:35 deraadt Exp $ 36.\" $OpenBSD: bsearch.3,v 1.4 1999/06/29 18:36:19 aaron Exp $
37.\" 37.\"
38.Dd April 19, 1994 38.Dd April 19, 1994
39.Dt BSEARCH 3 39.Dt BSEARCH 3
@@ -50,12 +50,12 @@ The
50.Fn bsearch 50.Fn bsearch
51function searches an array of 51function searches an array of
52.Fa nmemb 52.Fa nmemb
53objects, the initial member of which is 53objects, the initial member of which is
54pointed to by 54pointed to by
55.Fa base , 55.Fa base ,
56for a member that matches the object pointed to by 56for a member that matches the object pointed to by
57.Fa key . 57.Fa key .
58The size of each member of the array is specified by 58The size of each member of the array is specified by
59.Fa size . 59.Fa size .
60.Pp 60.Pp
61The contents of the array should be in ascending sorted order according 61The contents of the array should be in ascending sorted order according
diff --git a/src/lib/libc/stdlib/calloc.3 b/src/lib/libc/stdlib/calloc.3
index 9bd7f1d8da..7b78521c4a 100644
--- a/src/lib/libc/stdlib/calloc.3
+++ b/src/lib/libc/stdlib/calloc.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: calloc.3,v 1.4 1999/05/16 19:55:13 alex Exp $ 36.\" $OpenBSD: calloc.3,v 1.5 1999/06/29 18:36:19 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt CALLOC 3 39.Dt CALLOC 3
@@ -48,7 +48,7 @@
48.Sh DESCRIPTION 48.Sh DESCRIPTION
49The 49The
50.Fn calloc 50.Fn calloc
51function allocates space for an array of 51function allocates space for an array of
52.Fa nmemb 52.Fa nmemb
53objects, each of whose size is 53objects, each of whose size is
54.Fa size . 54.Fa size .
diff --git a/src/lib/libc/stdlib/div.3 b/src/lib/libc/stdlib/div.3
index c766d37fab..5cc3b8757c 100644
--- a/src/lib/libc/stdlib/div.3
+++ b/src/lib/libc/stdlib/div.3
@@ -31,7 +31,7 @@
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE. 32.\" SUCH DAMAGE.
33.\" 33.\"
34.\" $OpenBSD: div.3,v 1.3 1999/05/16 19:55:14 alex Exp $ 34.\" $OpenBSD: div.3,v 1.4 1999/06/29 18:36:19 aaron Exp $
35.\" 35.\"
36.Dd April 19, 1991 36.Dd April 19, 1991
37.Dt DIV 3 37.Dt DIV 3
@@ -48,11 +48,11 @@ The
48.Fn div 48.Fn div
49function 49function
50computes the value 50computes the value
51.Fa num/denom 51.Fa num Ns No / Ns Fa denom
52and returns the quotient and remainder in a structure named 52and returns the quotient and remainder in a structure named
53.Fa div_t 53.Fa div_t
54that contains two 54that contains two
55.Em int 55.Li int
56members named 56members named
57.Fa quot 57.Fa quot
58and 58and
diff --git a/src/lib/libc/stdlib/getenv.3 b/src/lib/libc/stdlib/getenv.3
index 79556f30e8..c7858b55b0 100644
--- a/src/lib/libc/stdlib/getenv.3
+++ b/src/lib/libc/stdlib/getenv.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: getenv.3,v 1.4 1999/05/25 13:06:46 aaron Exp $ 36.\" $OpenBSD: getenv.3,v 1.5 1999/06/29 18:36:20 aaron Exp $
37.\" 37.\"
38.Dd December 11, 1993 38.Dd December 11, 1993
39.Dt GETENV 3 39.Dt GETENV 3
@@ -60,10 +60,10 @@ host
60.Em environment list . 60.Em environment list .
61For compatibility with differing environment conventions, 61For compatibility with differing environment conventions,
62the given arguments 62the given arguments
63.Ar name 63.Fa name
64and 64and
65.Ar value 65.Fa value
66may be appended and prepended, 66may be appended and prepended,
67respectively, 67respectively,
68with an equal sign 68with an equal sign
69.Dq Li \&= . 69.Dq Li \&= .
@@ -71,30 +71,30 @@ with an equal sign
71The 71The
72.Fn getenv 72.Fn getenv
73function obtains the current value of the environment variable, 73function obtains the current value of the environment variable,
74.Ar name . 74.Fa name .
75If the variable 75If the variable
76.Ar name 76.Fa name
77is not in the current environment, 77is not in the current environment,
78a null pointer is returned. 78a null pointer is returned.
79.Pp 79.Pp
80The 80The
81.Fn setenv 81.Fn setenv
82function inserts or resets the environment variable 82function inserts or resets the environment variable
83.Ar name 83.Fa name
84in the current environment list. 84in the current environment list.
85If the variable 85If the variable
86.Ar name 86.Fa name
87does not exist in the list, 87does not exist in the list,
88it is inserted with the given 88it is inserted with the given
89.Ar value . 89.Fa value .
90If the variable does exist, the argument 90If the variable does exist, the argument
91.Ar overwrite 91.Fa overwrite
92is tested; if 92is tested; if
93.Ar overwrite is 93.Fa overwrite
94zero, the 94is zero,
95variable is not reset, otherwise it is reset 95the variable is not reset, otherwise it is reset
96to the given 96to the given
97.Ar value . 97.Fa value .
98.Pp 98.Pp
99The 99The
100.Fn putenv 100.Fn putenv
@@ -122,7 +122,7 @@ is set to indicate the error and a
122.Pp 122.Pp
123If 123If
124.Fn getenv 124.Fn getenv
125is succesful, the string returned should be considered read-only. 125is succesful, the string returned should be considered read-only.
126.Sh ERRORS 126.Sh ERRORS
127.Bl -tag -width [ENOMEM] 127.Bl -tag -width [ENOMEM]
128.It Bq Er ENOMEM 128.It Bq Er ENOMEM
diff --git a/src/lib/libc/stdlib/getopt.3 b/src/lib/libc/stdlib/getopt.3
index 57d2c3668b..3c8779d788 100644
--- a/src/lib/libc/stdlib/getopt.3
+++ b/src/lib/libc/stdlib/getopt.3
@@ -29,7 +29,7 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: getopt.3,v 1.8 1999/05/27 13:09:09 aaron Exp $ 32.\" $OpenBSD: getopt.3,v 1.9 1999/06/29 18:36:20 aaron Exp $
33.\" 33.\"
34.Dd April 19, 1994 34.Dd April 19, 1994
35.Dt GETOPT 3 35.Dt GETOPT 3
@@ -132,22 +132,25 @@ When all options have been processed (i.e., up to the first non-option
132argument), 132argument),
133.Fn getopt 133.Fn getopt
134returns \-1. 134returns \-1.
135.Sh SEE ALSO
136.Xr getopt 1 ,
137.Xr getsubopt 3
135.Sh DIAGNOSTICS 138.Sh DIAGNOSTICS
136If the 139If the
137.Fn getopt 140.Fn getopt
138function encounters a character not found in the string 141function encounters a character not found in the string
139.Va optstring 142.Va optstring
140or detects 143or detects
141a missing option argument it writes an error message to 144a missing option argument it writes an error message to
142.Em stderr 145.Em stderr
143and returns 146and returns
144.Ql ? . 147.Ql ? .
145Setting 148Setting
146.Va opterr 149.Va opterr
147to a zero will disable these error messages. 150to a zero will disable these error messages.
148If 151If
149.Va optstring 152.Va optstring
150has a leading 153has a leading
151.Ql \&: 154.Ql \&:
152then a missing option argument causes a 155then a missing option argument causes a
153.Ql \&: 156.Ql \&:
@@ -202,17 +205,17 @@ function appeared
202The 205The
203.Fn getopt 206.Fn getopt
204function was once specified to return 207function was once specified to return
205.Dv EOF 208.Dv EOF
206instead of \-1. 209instead of \-1.
207This was changed by 210This was changed by
208.St -p1003.2-92 211.St -p1003.2-92
209to decouple 212to decouple
210.Fn getopt 213.Fn getopt
211from 214from
212.Pa <stdio.h> . 215.Pa <stdio.h> .
213.Pp 216.Pp
214A single dash 217A single dash
215.Dq Li - 218.Pq Ql -
216may be specified as a character in 219may be specified as a character in
217.Fa optstring , 220.Fa optstring ,
218however it should 221however it should
@@ -221,7 +224,7 @@ have an argument associated with it.
221This allows 224This allows
222.Fn getopt 225.Fn getopt
223to be used with programs that expect 226to be used with programs that expect
224.Dq Li - 227.Ql -
225as an option flag. 228as an option flag.
226This practice is wrong, and should not be used in any current development. 229This practice is wrong, and should not be used in any current development.
227It is provided for backward compatibility 230It is provided for backward compatibility
diff --git a/src/lib/libc/stdlib/getsubopt.3 b/src/lib/libc/stdlib/getsubopt.3
index 8acc91bdd1..0ea48864c3 100644
--- a/src/lib/libc/stdlib/getsubopt.3
+++ b/src/lib/libc/stdlib/getsubopt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: getsubopt.3,v 1.2 1998/06/15 17:55:07 mickey Exp $ 1.\" $OpenBSD: getsubopt.3,v 1.3 1999/06/29 18:36:20 aaron Exp $
2.\" 2.\"
3.\" Copyright (c) 1990, 1991, 1993 3.\" Copyright (c) 1990, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
@@ -60,8 +60,7 @@ The argument
60is a pointer to a pointer to the string. 60is a pointer to a pointer to the string.
61The argument 61The argument
62.Fa tokens 62.Fa tokens
63is a pointer to a 63is a pointer to a null-terminated
64.Dv NULL Ns -terminated
65array of pointers to strings. 64array of pointers to strings.
66.Pp 65.Pp
67The 66The
diff --git a/src/lib/libc/stdlib/labs.3 b/src/lib/libc/stdlib/labs.3
index 2d9d6029db..de0b76ba1f 100644
--- a/src/lib/libc/stdlib/labs.3
+++ b/src/lib/libc/stdlib/labs.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: labs.3,v 1.3 1999/05/16 19:55:14 alex Exp $ 36.\" $OpenBSD: labs.3,v 1.4 1999/06/29 18:36:20 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt LABS 3 39.Dt LABS 3
@@ -50,7 +50,7 @@ The
50.Fn labs 50.Fn labs
51function 51function
52returns the absolute value of the long integer 52returns the absolute value of the long integer
53.Ar j . 53.Fa j .
54.Sh SEE ALSO 54.Sh SEE ALSO
55.Xr abs 3 , 55.Xr abs 3 ,
56.Xr cabs 3 , 56.Xr cabs 3 ,
diff --git a/src/lib/libc/stdlib/ldiv.3 b/src/lib/libc/stdlib/ldiv.3
index f5f22881b9..60b35dc98f 100644
--- a/src/lib/libc/stdlib/ldiv.3
+++ b/src/lib/libc/stdlib/ldiv.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: ldiv.3,v 1.3 1999/05/16 19:55:15 alex Exp $ 36.\" $OpenBSD: ldiv.3,v 1.4 1999/06/29 18:36:21 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt LDIV 3 39.Dt LDIV 3
@@ -50,15 +50,15 @@ The
50.Fn ldiv 50.Fn ldiv
51function 51function
52computes the value 52computes the value
53.Ar num/denom 53.Fa num Ns No / Ns Fa denom
54and returns the quotient and remainder in a structure named 54and returns the quotient and remainder in a structure named
55.Ar ldiv_t 55.Li ldiv_t
56that contains two 56that contains two
57.Em long integer 57.Li long integer
58members named 58members named
59.Ar quot 59.Fa quot
60and 60and
61.Ar rem . 61.Fa rem .
62.Sh SEE ALSO 62.Sh SEE ALSO
63.Xr div 3 , 63.Xr div 3 ,
64.Xr math 3 , 64.Xr math 3 ,
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index 023a58b832..e7c237c63a 100644
--- a/src/lib/libc/stdlib/malloc.3
+++ b/src/lib/libc/stdlib/malloc.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: malloc.3,v 1.14 1999/05/27 20:49:35 aaron Exp $ 36.\" $OpenBSD: malloc.3,v 1.15 1999/06/29 18:36:21 aaron Exp $
37.\" 37.\"
38.Dd August 27, 1996 38.Dd August 27, 1996
39.Dt MALLOC 3 39.Dt MALLOC 3
@@ -113,9 +113,9 @@ If
113is a null pointer, the 113is a null pointer, the
114.Fn realloc 114.Fn realloc
115function behaves like the 115function behaves like the
116.Fn malloc 116.Fn malloc
117function for the specified size. 117function for the specified size.
118If the space cannot be allocated, the object 118If the space cannot be allocated, the object
119pointed to by 119pointed to by
120.Fa ptr 120.Fa ptr
121is unchanged. 121is unchanged.
@@ -137,7 +137,7 @@ if ((p = realloc(p, nsize)) == NULL)
137.Pp 137.Pp
138In most cases, this will result in a leak of memory. 138In most cases, this will result in a leak of memory.
139As stated earlier, a return value of 139As stated earlier, a return value of
140.Fa NULL 140.Dv NULL
141indicates that the old object still remains allocated. 141indicates that the old object still remains allocated.
142Better code looks like this: 142Better code looks like this:
143.Bd -literal -offset indent 143.Bd -literal -offset indent
@@ -163,7 +163,7 @@ Flags are single letters, uppercase means on, lowercase means off.
163``abort'' malloc will coredump the process, rather than tolerate failure. 163``abort'' malloc will coredump the process, rather than tolerate failure.
164This is a very handy debugging aid, since the core file will represent the 164This is a very handy debugging aid, since the core file will represent the
165time of failure, 165time of failure,
166rather than when the NULL pointer was accessed. 166rather than when the null pointer was accessed.
167.Pp 167.Pp
168.It D 168.It D
169``dump'' malloc will dump statistics in a file called ``malloc.out'' at exit. 169``dump'' malloc will dump statistics in a file called ``malloc.out'' at exit.
@@ -195,7 +195,7 @@ for all operations.
195Consult the source for this one. 195Consult the source for this one.
196.Pp 196.Pp
197.It X 197.It X
198``xmalloc'' 198``xmalloc''
199rather than return failure, 199rather than return failure,
200.Xr abort 3 200.Xr abort 3
201the program with a diagnostic message on stderr. 201the program with a diagnostic message on stderr.
@@ -244,15 +244,15 @@ The
244function a pointer to the possibly moved allocated space; 244function a pointer to the possibly moved allocated space;
245otherwise a null pointer is returned. 245otherwise a null pointer is returned.
246.Sh MESSAGES 246.Sh MESSAGES
247If 247If
248.Fn malloc , 248.Fn malloc ,
249.Fn free 249.Fn free
250or 250or
251.Fn realloc 251.Fn realloc
252detects an error or warning condition, 252detects an error or warning condition,
253a message will be printed to filedescriptor 253a message will be printed to filedescriptor
2542 (not using stdio). 2542 (not using stdio).
255Errors will always result in the process being 255Errors will always result in the process being
256.Xr abort 3 'ed. 256.Xr abort 3 'ed.
257If the ``A'' option has been specified, warnings will also 257If the ``A'' option has been specified, warnings will also
258.Xr abort 3 258.Xr abort 3
@@ -267,9 +267,10 @@ fishy in there. Consult sources and or wizards.
267``allocation failed'' 267``allocation failed''
268if the ``A'' option is specified it is an error for 268if the ``A'' option is specified it is an error for
269.Fn malloc 269.Fn malloc
270or 270or
271.Fn realloc 271.Fn realloc
272to return NULL. 272to return
273.Dv NULL .
273.Pp 274.Pp
274``mmap(2) failed, check limits.'' 275``mmap(2) failed, check limits.''
275This is a rather weird condition that is most likely to mean that 276This is a rather weird condition that is most likely to mean that
@@ -287,7 +288,7 @@ A pointer to a free chunk is attempted freed again.
287The pointer doesn't make sense. It's above the area of memory that 288The pointer doesn't make sense. It's above the area of memory that
288malloc knows something about. 289malloc knows something about.
289This could be a pointer from some 290This could be a pointer from some
290.Xr mmap 2 'ed 291.Xr mmap 2 'ed
291memory. 292memory.
292.Pp 293.Pp
293``junk pointer, too low to make sense.'' 294``junk pointer, too low to make sense.''
@@ -344,7 +345,7 @@ secondary.
344.Pp 345.Pp
345The main difference from other malloc implementations are believed to be that 346The main difference from other malloc implementations are believed to be that
346the free pages are not accessed until allocated. 347the free pages are not accessed until allocated.
347Most malloc implementations will store a data structure containing a, 348Most malloc implementations will store a data structure containing a,
348possibly double-, linked list in the free chunks of memory, used to tie 349possibly double-, linked list in the free chunks of memory, used to tie
349all the free memory together. 350all the free memory together.
350That is a quite suboptimal thing to do. 351That is a quite suboptimal thing to do.
diff --git a/src/lib/libc/stdlib/qabs.3 b/src/lib/libc/stdlib/qabs.3
index cdfaa81bf9..0f7ccdc78f 100644
--- a/src/lib/libc/stdlib/qabs.3
+++ b/src/lib/libc/stdlib/qabs.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: qabs.3,v 1.3 1999/05/16 19:55:16 alex Exp $ 36.\" $OpenBSD: qabs.3,v 1.4 1999/06/29 18:36:21 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt QABS 3 39.Dt QABS 3
@@ -50,7 +50,7 @@ The
50.Fn qabs 50.Fn qabs
51function 51function
52returns the absolute value of the quad integer 52returns the absolute value of the quad integer
53.Ar j . 53.Fa j .
54.Sh SEE ALSO 54.Sh SEE ALSO
55.Xr abs 3 , 55.Xr abs 3 ,
56.Xr cabs 3 , 56.Xr cabs 3 ,
diff --git a/src/lib/libc/stdlib/qdiv.3 b/src/lib/libc/stdlib/qdiv.3
index 12aca0b1ea..127c581250 100644
--- a/src/lib/libc/stdlib/qdiv.3
+++ b/src/lib/libc/stdlib/qdiv.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: qdiv.3,v 1.2 1996/08/19 08:33:41 tholo Exp $ 36.\" $OpenBSD: qdiv.3,v 1.3 1999/06/29 18:36:21 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt QDIV 3 39.Dt QDIV 3
@@ -50,15 +50,15 @@ The
50.Fn qdiv 50.Fn qdiv
51function 51function
52computes the value 52computes the value
53.Ar num/denom 53.Fa num Ns No / Ns Fa denom
54and returns the quotient and remainder in a structure named 54and returns the quotient and remainder in a structure named
55.Ar qdiv_t 55.Li qdiv_t
56that contains two 56that contains two
57.Em quad integer 57.Li quad integer
58members named 58members named
59.Ar quot 59.Fa quot
60and 60and
61.Ar rem . 61.Fa rem .
62.Sh SEE ALSO 62.Sh SEE ALSO
63.Xr div 3 , 63.Xr div 3 ,
64.Xr ldiv 3 , 64.Xr ldiv 3 ,
diff --git a/src/lib/libc/stdlib/qsort.3 b/src/lib/libc/stdlib/qsort.3
index 0a71824450..8d665187bf 100644
--- a/src/lib/libc/stdlib/qsort.3
+++ b/src/lib/libc/stdlib/qsort.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: qsort.3,v 1.3 1999/02/27 21:56:00 deraadt Exp $ 36.\" $OpenBSD: qsort.3,v 1.4 1999/06/29 18:36:22 aaron Exp $
37.\" 37.\"
38.Dd June 4, 1993 38.Dd June 4, 1993
39.Dt QSORT 3 39.Dt QSORT 3
@@ -131,7 +131,7 @@ The function
131.Fn mergesort 131.Fn mergesort
132requires additional memory of size 132requires additional memory of size
133.Fa nmemb * 133.Fa nmemb *
134.Fa size 134.Fa size
135bytes; it should be used only when space is not at a premium. 135bytes; it should be used only when space is not at a premium.
136.Fn mergesort 136.Fn mergesort
137is optimized for data with pre-existing order; its worst case 137is optimized for data with pre-existing order; its worst case
diff --git a/src/lib/libc/stdlib/radixsort.3 b/src/lib/libc/stdlib/radixsort.3
index 8b0ea89a0f..a1a4ee4eab 100644
--- a/src/lib/libc/stdlib/radixsort.3
+++ b/src/lib/libc/stdlib/radixsort.3
@@ -29,7 +29,7 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: radixsort.3,v 1.4 1998/06/15 17:55:08 mickey Exp $ 32.\" $OpenBSD: radixsort.3,v 1.5 1999/06/29 18:36:22 aaron Exp $
33.\" 33.\"
34.Dd January 27, 1994 34.Dd January 27, 1994
35.Dt RADIXSORT 3 35.Dt RADIXSORT 3
@@ -62,8 +62,7 @@ is denoted by the user-specified value
62Applications may specify a sort order by providing the 62Applications may specify a sort order by providing the
63.Fa table 63.Fa table
64argument. 64argument.
65If 65If non-null,
66.Pf non- Dv NULL ,
67.Fa table 66.Fa table
68must reference an array of 67must reference an array of
69.Dv UCHAR_MAX 68.Dv UCHAR_MAX
@@ -80,7 +79,9 @@ equally, for example, providing a table with the same weights
80for A-Z as for a-z will result in a case-insensitive sort. 79for A-Z as for a-z will result in a case-insensitive sort.
81If 80If
82.Fa table 81.Fa table
83is NULL, the contents of the array are sorted in ascending order 82is
83.Dv NULL ,
84the contents of the array are sorted in ascending order
84according to the 85according to the
85.Tn ASCII 86.Tn ASCII
86order of the byte strings they reference and 87order of the byte strings they reference and
@@ -106,7 +107,7 @@ particular, see D.E. Knuth's Algorithm R and section 5.2.5, exercise 10.
106They take linear time relative to the number of bytes in the strings. 107They take linear time relative to the number of bytes in the strings.
107.Sh RETURN VALUES 108.Sh RETURN VALUES
108Upon successful completion 0 is returned. 109Upon successful completion 0 is returned.
109Otherwise, \-1 is returned and the global variable 110Otherwise, \-1 is returned and the global variable
110.Va errno 111.Va errno
111is set to indicate the error. 112is set to indicate the error.
112.Sh ERRORS 113.Sh ERRORS
diff --git a/src/lib/libc/stdlib/rand.3 b/src/lib/libc/stdlib/rand.3
index 28496ec12a..d5686e5f4c 100644
--- a/src/lib/libc/stdlib/rand.3
+++ b/src/lib/libc/stdlib/rand.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: rand.3,v 1.5 1998/11/20 11:18:50 d Exp $ 36.\" $OpenBSD: rand.3,v 1.6 1999/06/29 18:36:22 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt RAND 3 39.Dt RAND 3
@@ -81,7 +81,7 @@ The
81is a thread-safe version of 81is a thread-safe version of
82.Fn rand . 82.Fn rand .
83Storage for the seed must be provided through the 83Storage for the seed must be provided through the
84.Ar seed 84.Fa seed
85argument, and needs to have been initialized by the caller. 85argument, and needs to have been initialized by the caller.
86.Sh SEE ALSO 86.Sh SEE ALSO
87.Xr arc4random 3 , 87.Xr arc4random 3 ,
diff --git a/src/lib/libc/stdlib/rand48.3 b/src/lib/libc/stdlib/rand48.3
index efd6477364..f1615027da 100644
--- a/src/lib/libc/stdlib/rand48.3
+++ b/src/lib/libc/stdlib/rand48.3
@@ -9,7 +9,7 @@
9.\" of any kind. I shall in no event be liable for anything that happens 9.\" of any kind. I shall in no event be liable for anything that happens
10.\" to anyone/anything when using this software. 10.\" to anyone/anything when using this software.
11.\" 11.\"
12.\" $OpenBSD: rand48.3,v 1.4 1999/03/11 01:35:01 pjanzen Exp $ 12.\" $OpenBSD: rand48.3,v 1.5 1999/06/29 18:36:22 aaron Exp $
13.\" 13.\"
14.Dd October 8, 1993 14.Dd October 8, 1993
15.Dt RAND48 3 15.Dt RAND48 3
@@ -27,7 +27,7 @@
27.Nd pseudo random number generators and initialization routines 27.Nd pseudo random number generators and initialization routines
28.Sh SYNOPSIS 28.Sh SYNOPSIS
29.Fd #include <stdlib.h> 29.Fd #include <stdlib.h>
30.Ft double 30.Ft double
31.Fn drand48 void 31.Fn drand48 void
32.Ft double 32.Ft double
33.Fn erand48 "unsigned short xseed[3]" 33.Fn erand48 "unsigned short xseed[3]"
diff --git a/src/lib/libc/stdlib/random.3 b/src/lib/libc/stdlib/random.3
index 47cdfea9b3..e1ab9e44da 100644
--- a/src/lib/libc/stdlib/random.3
+++ b/src/lib/libc/stdlib/random.3
@@ -29,7 +29,7 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: random.3,v 1.7 1999/05/23 14:11:03 aaron Exp $ 32.\" $OpenBSD: random.3,v 1.8 1999/06/29 18:36:23 aaron Exp $
33.\" 33.\"
34.Dd April 19, 1991 34.Dd April 19, 1991
35.Dt RANDOM 3 35.Dt RANDOM 3
@@ -42,7 +42,7 @@
42.Nd better random number generator; routines for changing generators 42.Nd better random number generator; routines for changing generators
43.Sh SYNOPSIS 43.Sh SYNOPSIS
44.Fd #include <stdlib.h> 44.Fd #include <stdlib.h>
45.Ft long 45.Ft long
46.Fn random void 46.Fn random void
47.Ft void 47.Ft void
48.Fn srandom "unsigned int seed" 48.Fn srandom "unsigned int seed"
@@ -96,7 +96,7 @@ however,
96will by default produce a sequence of numbers that can be duplicated 96will by default produce a sequence of numbers that can be duplicated
97by calling 97by calling
98.Fn srandom 98.Fn srandom
99with 99with
100.Ql 1 100.Ql 1
101as the seed. 101as the seed.
102.Pp 102.Pp
@@ -167,16 +167,16 @@ messages are printed on the standard error output.
167.Xr rand 3 167.Xr rand 3
168.Sh STANDARDS 168.Sh STANDARDS
169The 169The
170.Fn random , 170.Fn random ,
171.Fn srandom , 171.Fn srandom ,
172.Fn initstate , 172.Fn initstate ,
173and 173and
174.Fn setstate 174.Fn setstate
175functions conform to 175functions conform to
176.St -xpg4.2 . 176.St -xpg4.2 .
177.Sh HISTORY 177.Sh HISTORY
178These 178These
179functions appeared in 179functions appeared in
180.Bx 4.2 . 180.Bx 4.2 .
181.Sh BUGS 181.Sh BUGS
182About 2/3 the speed of 182About 2/3 the speed of
diff --git a/src/lib/libc/stdlib/realpath.3 b/src/lib/libc/stdlib/realpath.3
index 7efccbf1b6..814c36ec13 100644
--- a/src/lib/libc/stdlib/realpath.3
+++ b/src/lib/libc/stdlib/realpath.3
@@ -32,7 +32,7 @@
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE. 33.\" SUCH DAMAGE.
34.\" 34.\"
35.\" $OpenBSD: realpath.3,v 1.4 1999/05/28 01:57:36 aaron Exp $ 35.\" $OpenBSD: realpath.3,v 1.5 1999/06/29 18:36:23 aaron Exp $
36.\" 36.\"
37.Dd February, 16, 1994 37.Dd February, 16, 1994
38.Dt REALPATH 3 38.Dt REALPATH 3
@@ -67,7 +67,7 @@ refer to a buffer capable of storing at least
67.Dv MAXPATHLEN 67.Dv MAXPATHLEN
68characters. 68characters.
69.Pp 69.Pp
70The 70The
71.Fn realpath 71.Fn realpath
72function will resolve both absolute and relative paths 72function will resolve both absolute and relative paths
73and return the absolute pathname corresponding to 73and return the absolute pathname corresponding to
diff --git a/src/lib/libc/stdlib/strtod.3 b/src/lib/libc/stdlib/strtod.3
index 14981139c6..6bba73e89a 100644
--- a/src/lib/libc/stdlib/strtod.3
+++ b/src/lib/libc/stdlib/strtod.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: strtod.3,v 1.3 1999/05/27 20:49:35 aaron Exp $ 36.\" $OpenBSD: strtod.3,v 1.4 1999/06/29 18:36:23 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt STRTOD 3 39.Dt STRTOD 3
@@ -50,11 +50,11 @@ string to double
50.Sh DESCRIPTION 50.Sh DESCRIPTION
51The 51The
52.Fn strtod 52.Fn strtod
53function converts the initial portion of the string 53function converts the initial portion of the string
54pointed to by 54pointed to by
55.Fa nptr 55.Fa nptr
56to 56to
57.Em double 57.Li double
58representation. 58representation.
59.Pp 59.Pp
60The expected form of the string is an optional plus (``+'') or minus 60The expected form of the string is an optional plus (``+'') or minus
@@ -93,7 +93,7 @@ is stored in
93If the correct value would cause underflow, zero is 93If the correct value would cause underflow, zero is
94returned and 94returned and
95.Dv ERANGE 95.Dv ERANGE
96is stored in 96is stored in
97.Va errno . 97.Va errno .
98.Sh ERRORS 98.Sh ERRORS
99.Bl -tag -width Er 99.Bl -tag -width Er
diff --git a/src/lib/libc/stdlib/strtol.3 b/src/lib/libc/stdlib/strtol.3
index b7d2cd1225..006ba904a5 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.3 1996/08/19 08:33:51 tholo Exp $ 36.\" $OpenBSD: strtol.3,v 1.4 1999/06/29 18:36:23 aaron Exp $
37.\" 37.\"
38.Dd June 25, 1992 38.Dd June 25, 1992
39.Dt STRTOL 3 39.Dt STRTOL 3
@@ -59,7 +59,7 @@ function
59converts the string in 59converts the string in
60.Fa nptr 60.Fa nptr
61to a 61to a
62.Em long 62.Li long
63value. 63value.
64The 64The
65.Fn strtoq 65.Fn strtoq
@@ -67,7 +67,7 @@ function
67converts the string in 67converts the string in
68.Fa nptr 68.Fa nptr
69to a 69to a
70.Em quad_t 70.Li quad_t
71value. 71value.
72The conversion is done according to the given 72The conversion is done according to the given
73.Fa base , 73.Fa base ,
@@ -95,7 +95,7 @@ is taken as 10 (decimal) unless the next character is
95in which case it is taken as 8 (octal). 95in which case it is taken as 8 (octal).
96.Pp 96.Pp
97The remainder of the string is converted to a 97The remainder of the string is converted to a
98.Em long 98.Li long
99value in the obvious manner, 99value in the obvious manner,
100stopping at the first character which is not a valid digit 100stopping at the first character which is not a valid digit
101in the given base. 101in the given base.
diff --git a/src/lib/libc/stdlib/strtoul.3 b/src/lib/libc/stdlib/strtoul.3
index b8234122a2..3b2a90adc3 100644
--- a/src/lib/libc/stdlib/strtoul.3
+++ b/src/lib/libc/stdlib/strtoul.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: strtoul.3,v 1.2 1996/08/19 08:33:52 tholo Exp $ 36.\" $OpenBSD: strtoul.3,v 1.3 1999/06/29 18:36:24 aaron Exp $
37.\" 37.\"
38.Dd June 25, 1992 38.Dd June 25, 1992
39.Dt STRTOUL 3 39.Dt STRTOUL 3
@@ -59,7 +59,7 @@ function
59converts the string in 59converts the string in
60.Fa nptr 60.Fa nptr
61to an 61to an
62.Em unsigned long 62.Li unsigned long
63value. 63value.
64The 64The
65.Fn strtouq 65.Fn strtouq
@@ -67,7 +67,7 @@ function
67converts the string in 67converts the string in
68.Fa nptr 68.Fa nptr
69to a 69to a
70.Em u_quad_t 70.Li u_quad_t
71value. 71value.
72The conversion is done according to the given 72The conversion is done according to the given
73.Fa base , 73.Fa base ,
@@ -95,7 +95,7 @@ is taken as 10 (decimal) unless the next character is
95in which case it is taken as 8 (octal). 95in which case it is taken as 8 (octal).
96.Pp 96.Pp
97The remainder of the string is converted to an 97The remainder of the string is converted to an
98.Em unsigned long 98.Li unsigned long
99value in the obvious manner, 99value in the obvious manner,
100stopping at the end of the string 100stopping at the end of the string
101or at the first character that does not produce a valid digit 101or at the first character that does not produce a valid digit
diff --git a/src/lib/libc/stdlib/system.3 b/src/lib/libc/stdlib/system.3
index 985adb07de..f2d2693677 100644
--- a/src/lib/libc/stdlib/system.3
+++ b/src/lib/libc/stdlib/system.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: system.3,v 1.5 1996/12/11 23:09:53 tholo Exp $ 36.\" $OpenBSD: system.3,v 1.6 1999/06/29 18:36:24 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt SYSTEM 3 39.Dt SYSTEM 3
@@ -70,18 +70,18 @@ pointer,
70will return non-zero. 70will return non-zero.
71Otherwise, 71Otherwise,
72.Fn system 72.Fn system
73returns the termination status of the shell in the format specified by 73returns the termination status of the shell in the format specified by
74.Xr waitpid 2 . 74.Xr waitpid 2 .
75.Sh RETURN VALUES 75.Sh RETURN VALUES
76If a child process cannot be created, or the termination status of 76If a child process cannot be created, or the termination status of
77the shell cannot be obtained, 77the shell cannot be obtained,
78.Fn system 78.Fn system
79returns -1 and sets 79returns \-1 and sets
80.Va errno 80.Va errno
81to indicate the error. 81to indicate the error.
82If execution of the shell fails, 82If execution of the shell fails,
83.Fn system 83.Fn system
84returns the termination status for a program that terminates with a call of 84returns the termination status for a program that terminates with a call of
85.Fn exit 127 . 85.Fn exit 127 .
86.Sh SEE ALSO 86.Sh SEE ALSO
87.Xr sh 1 , 87.Xr sh 1 ,
@@ -93,6 +93,6 @@ The
93.Fn system 93.Fn system
94function 94function
95conforms to 95conforms to
96.St -ansiC 96.St -ansiC
97and 97and
98.St -p1003.2-92 . 98.St -p1003.2-92 .
diff --git a/src/lib/libc/stdlib/tsearch.3 b/src/lib/libc/stdlib/tsearch.3
index cb8b050e7b..8456457e27 100644
--- a/src/lib/libc/stdlib/tsearch.3
+++ b/src/lib/libc/stdlib/tsearch.3
@@ -23,7 +23,7 @@
23.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25.\" 25.\"
26.\" $OpenBSD: tsearch.3,v 1.4 1999/05/10 17:56:28 aaron Exp $ 26.\" $OpenBSD: tsearch.3,v 1.5 1999/06/29 18:36:24 aaron Exp $
27.\" 27.\"
28.Dd June 15, 1997 28.Dd June 15, 1997
29.Dt TSEARCH 3 29.Dt TSEARCH 3
@@ -58,7 +58,8 @@ searches for the datum matched by the argument
58.Fa key 58.Fa key
59in the binary tree rooted at 59in the binary tree rooted at
60.Fa rootp , 60.Fa rootp ,
61returning a pointer to the datum if it is found and NULL 61returning a pointer to the datum if it is found and
62.Dv NULL
62if it is not. 63if it is not.
63.Pp 64.Pp
64.Fn tsearch 65.Fn tsearch
@@ -68,7 +69,7 @@ except that if no match is found,
68.Fa key 69.Fa key
69is inserted into the tree and a pointer to it is returned. If 70is inserted into the tree and a pointer to it is returned. If
70.Fa rootp 71.Fa rootp
71points to a NULL value a new binary search tree is created. 72points to a null value a new binary search tree is created.
72.Pp 73.Pp
73.Fn tdelete 74.Fn tdelete
74deletes a node from the specified binary search tree and returns 75deletes a node from the specified binary search tree and returns
@@ -89,7 +90,7 @@ and calls the function
89on each node. 90on each node.
90.Fa action 91.Fa action
91is called with three arguments: a pointer to the current node, 92is called with three arguments: a pointer to the current node,
92a value from the enum 93a value from the enum
93.Sy "typedef enum { preorder, postorder, endorder, leaf } VISIT;" 94.Sy "typedef enum { preorder, postorder, endorder, leaf } VISIT;"
94specifying the traversal type, and a node level (where level 95specifying the traversal type, and a node level (where level
95zero is the root of the tree). 96zero is the root of the tree).
@@ -99,16 +100,22 @@ zero is the root of the tree).
99.Sh RETURN VALUES 100.Sh RETURN VALUES
100The 101The
101.Fn tsearch 102.Fn tsearch
102function returns NULL if allocation of a new node fails (usually 103function returns
104.Dv NULL
105if allocation of a new node fails (usually
103due to a lack of free memory). 106due to a lack of free memory).
104.Pp 107.Pp
105.Fn tfind , 108.Fn tfind ,
106.Fn tsearch , 109.Fn tsearch ,
107and 110and
108.Fn tdelete 111.Fn tdelete
109return NULL if 112return
113.Dv NULL
114if
110.Fa rootp 115.Fa rootp
111is NULL or the datum cannot be found. 116is
117.Dv NULL
118or the datum cannot be found.
112.Pp 119.Pp
113The 120The
114.Fn twalk 121.Fn twalk