summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdlib/a64l.359
-rw-r--r--lib/libc/stdlib/abort.34
-rw-r--r--lib/libc/stdlib/abs.34
-rw-r--r--lib/libc/stdlib/alloca.36
-rw-r--r--lib/libc/stdlib/atexit.36
-rw-r--r--lib/libc/stdlib/atof.36
-rw-r--r--lib/libc/stdlib/atoi.36
-rw-r--r--lib/libc/stdlib/atol.36
-rw-r--r--lib/libc/stdlib/bsearch.36
-rw-r--r--lib/libc/stdlib/calloc.34
-rw-r--r--lib/libc/stdlib/div.36
-rw-r--r--lib/libc/stdlib/getenv.330
-rw-r--r--lib/libc/stdlib/getopt.323
-rw-r--r--lib/libc/stdlib/getsubopt.35
-rw-r--r--lib/libc/stdlib/labs.34
-rw-r--r--lib/libc/stdlib/ldiv.312
-rw-r--r--lib/libc/stdlib/malloc.327
-rw-r--r--lib/libc/stdlib/qabs.34
-rw-r--r--lib/libc/stdlib/qdiv.312
-rw-r--r--lib/libc/stdlib/qsort.34
-rw-r--r--lib/libc/stdlib/radixsort.311
-rw-r--r--lib/libc/stdlib/rand.34
-rw-r--r--lib/libc/stdlib/rand48.34
-rw-r--r--lib/libc/stdlib/random.314
-rw-r--r--lib/libc/stdlib/realpath.34
-rw-r--r--lib/libc/stdlib/strtod.38
-rw-r--r--lib/libc/stdlib/strtol.38
-rw-r--r--lib/libc/stdlib/strtoul.38
-rw-r--r--lib/libc/stdlib/system.316
-rw-r--r--lib/libc/stdlib/tsearch.321
30 files changed, 182 insertions, 150 deletions
diff --git a/lib/libc/stdlib/a64l.3 b/lib/libc/stdlib/a64l.3
index 0607338cbaf..1074dbff2e7 100644
--- a/lib/libc/stdlib/a64l.3
+++ b/lib/libc/stdlib/a64l.3
@@ -24,7 +24,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: a64l.3,v 1.3 1999/02/27 21:55:53 deraadt Exp $
+.\" $OpenBSD: a64l.3,v 1.4 1999/06/29 18:36:15 aaron Exp $
.\"
.Dd August 17, 1997
.Dt A64L 3
@@ -45,19 +45,36 @@ The
and
.Fn l64a
functions are used to maintain numbers stored in radix-64
-ASCII characters. This is a notation by which 32-bit integers
+.Tn ASCII
+characters. This is a notation by which 32-bit integers
can be represented by up to six characters; each character
-represents a "digit" in a radix-64 notation.
+represents a
+.Dq digit
+in a radix-64 notation.
.Pp
-The characters used to represent "digits" are '.' for 0, '/' for 1,
-'0' through '9' for 2-11, 'A' through 'Z' for 12-37, and 'a' through
-'z' for 38-63.
+The characters used to represent digits are
+.Ql \&.
+for 0,
+.Ql /
+for 1,
+.Ql 0
+through
+.Ql 9
+for 2-11,
+.Ql A
+through
+.Ql Z
+for 12-37, and
+.Ql a
+through
+.Ql z
+for 38-63.
.Pp
The
.Fn a64l
function takes a pointer to a null-terminated radix-64 representation
and returns a corresponding 32-bit value. If the string pointed to by
-.Ar s
+.Fa s
contains more than six characters,
.Fn a64l
will use the first six.
@@ -68,35 +85,39 @@ larger than 32 bits, the return value will be sign-extended.
.Pp
.Fn l64a
takes a long integer argument
-.Ar l
+.Fa l
and returns a pointer to the corresponding radix-64 representation.
.Sh RETURN VALUES
On success,
.Fn a64l
returns a 32-bit representation of
-.Ar s .
+.Fa s .
If
-.Ar s
-is a NULL pointer or if it contains "digits" other than those described above,
+.Fa s
+is a null pointer or if it contains digits other than those described above.
.Fn a64l
-returns -1L and sets the global variable errno to
-.Va EINVAL .
+returns \-1 and sets the global variable
+.Va errno
+to
+.Er EINVAL .
.Pp
On success,
.Fn l64a
returns a pointer to a string containing the radix-64 representation of
-.Ar l .
+.Fa l .
If
-.Ar l
+.Fa l
is 0,
.Fn l64a
returns a pointer to the empty string.
If
-.Ar l
+.Fa l
is negative,
.Fn l64a
-returns a NULL pointer and sets the global variable errno to
-.Va EINVAL .
+returns a null pointer and sets the global variable
+.Va errno
+to
+.Er EINVAL .
.Sh WARNINGS
The value returned by
.Fn l64a
@@ -115,7 +136,7 @@ If a long integer is larger than 32 bits, only the low-order
32 bits are used.
.Sh STANDARDS
The
-.Fn a64l
+.Fn a64l
and
.Fn l64a
functions conform to
diff --git a/lib/libc/stdlib/abort.3 b/lib/libc/stdlib/abort.3
index 92c9a354d05..a0dfba7e802 100644
--- a/lib/libc/stdlib/abort.3
+++ b/lib/libc/stdlib/abort.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: abort.3,v 1.4 1997/07/17 07:39:41 deraadt Exp $
+.\" $OpenBSD: abort.3,v 1.5 1999/06/29 18:36:17 aaron Exp $
.\"
.Dd June 29, 1991
.Dt ABORT 3
@@ -56,7 +56,7 @@ is being caught and the signal handler does not return.
Any open streams are flushed and closed.
.Sh RETURN VALUES
The
-.Nm abort
+.Fn abort
function
never returns.
.Sh SEE ALSO
diff --git a/lib/libc/stdlib/abs.3 b/lib/libc/stdlib/abs.3
index ca203c4e60d..1e3675d7b56 100644
--- a/lib/libc/stdlib/abs.3
+++ b/lib/libc/stdlib/abs.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: abs.3,v 1.3 1999/05/16 19:55:12 alex Exp $
+.\" $OpenBSD: abs.3,v 1.4 1999/06/29 18:36:17 aaron Exp $
.\"
.Dd June 29, 1991
.Dt ABS 3
@@ -51,7 +51,7 @@ The
function
computes
the absolute value of the integer
-.Ar j .
+.Fa j .
.Sh RETURN VALUES
The
.Fn abs
diff --git a/lib/libc/stdlib/alloca.3 b/lib/libc/stdlib/alloca.3
index 2b64dcfc080..56d52ebe1b6 100644
--- a/lib/libc/stdlib/alloca.3
+++ b/lib/libc/stdlib/alloca.3
@@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: alloca.3,v 1.6 1999/05/23 14:11:03 aaron Exp $
+.\" $OpenBSD: alloca.3,v 1.7 1999/06/29 18:36:18 aaron Exp $
.\"
.Dd May 2, 1991
.Dt ALLOCA 3
@@ -45,7 +45,7 @@
The
.Fn alloca
function
-allocates
+allocates
.Fa size
bytes of space in the stack frame of the caller.
This temporary space is automatically freed on
@@ -70,6 +70,6 @@ is machine dependent; its use is discouraged.
.\" .Fn alloca
.\" function appeared in
.\" .Bx ?? .
-.\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd
+.\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd
.\" The first man page (or link to a man page that I can find at the
.\" moment is 4.3...
diff --git a/lib/libc/stdlib/atexit.3 b/lib/libc/stdlib/atexit.3
index 0b10f010fa0..cc37d08b00c 100644
--- a/lib/libc/stdlib/atexit.3
+++ b/lib/libc/stdlib/atexit.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: atexit.3,v 1.2 1996/08/19 08:33:22 tholo Exp $
+.\" $OpenBSD: atexit.3,v 1.3 1999/06/29 18:36:18 aaron Exp $
.\"
.Dd June 29, 1991
.Dt ATEXIT 3
@@ -50,11 +50,11 @@ The
.Fn atexit
function
registers the given
-.Ar function
+.Fa function
to be called at program exit, whether via
.Xr exit 3
or via return from the program's
-.Em main .
+.Fn main .
Functions so registered are called in reverse order;
no arguments are passed.
At least 32 functions can always be registered,
diff --git a/lib/libc/stdlib/atof.3 b/lib/libc/stdlib/atof.3
index cc1b500b0f9..0bd85dbe829 100644
--- a/lib/libc/stdlib/atof.3
+++ b/lib/libc/stdlib/atof.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: atof.3,v 1.2 1996/08/19 08:33:23 tholo Exp $
+.\" $OpenBSD: atof.3,v 1.3 1999/06/29 18:36:18 aaron Exp $
.\"
.Dd June 29, 1991
.Dt ATOF 3
@@ -51,9 +51,9 @@ string to double
The
.Fn atof
function converts the initial portion of the string pointed to by
-.Ar nptr
+.Fa nptr
to
-.Ar double
+.Li double
representation.
.Pp
It is equivalent to:
diff --git a/lib/libc/stdlib/atoi.3 b/lib/libc/stdlib/atoi.3
index 280a989e8e6..fa7b84e95c9 100644
--- a/lib/libc/stdlib/atoi.3
+++ b/lib/libc/stdlib/atoi.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: atoi.3,v 1.2 1996/08/10 04:51:31 tholo Exp $
+.\" $OpenBSD: atoi.3,v 1.3 1999/06/29 18:36:18 aaron Exp $
.\"
.Dd June 4, 1993
.Dt ATOI 3
@@ -51,9 +51,9 @@ string to integer
The
.Fn atoi
function converts the initial portion of the string pointed to by
-.Em nptr
+.Fa nptr
to
-.Em integer
+.Li integer
representation.
.Pp
It is equivalent to:
diff --git a/lib/libc/stdlib/atol.3 b/lib/libc/stdlib/atol.3
index 2b49bd1f2c3..c7b4ff30daa 100644
--- a/lib/libc/stdlib/atol.3
+++ b/lib/libc/stdlib/atol.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: atol.3,v 1.2 1996/08/19 08:33:25 tholo Exp $
+.\" $OpenBSD: atol.3,v 1.3 1999/06/29 18:36:19 aaron Exp $
.\"
.Dd June 29, 1991
.Dt ATOL 3
@@ -51,9 +51,9 @@ string to long integer
The
.Fn atol
function converts the initial portion of the string pointed to by
-.Ar nptr
+.Fa nptr
to
-.Em long integer
+.Li long integer
representation.
.Pp
It is equivalent to:
diff --git a/lib/libc/stdlib/bsearch.3 b/lib/libc/stdlib/bsearch.3
index 570a4227b42..63d4e6af69f 100644
--- a/lib/libc/stdlib/bsearch.3
+++ b/lib/libc/stdlib/bsearch.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: bsearch.3,v 1.3 1997/06/13 23:41:35 deraadt Exp $
+.\" $OpenBSD: bsearch.3,v 1.4 1999/06/29 18:36:19 aaron Exp $
.\"
.Dd April 19, 1994
.Dt BSEARCH 3
@@ -50,12 +50,12 @@ The
.Fn bsearch
function searches an array of
.Fa nmemb
-objects, the initial member of which is
+objects, the initial member of which is
pointed to by
.Fa base ,
for a member that matches the object pointed to by
.Fa key .
-The size of each member of the array is specified by
+The size of each member of the array is specified by
.Fa size .
.Pp
The contents of the array should be in ascending sorted order according
diff --git a/lib/libc/stdlib/calloc.3 b/lib/libc/stdlib/calloc.3
index 9bd7f1d8da6..7b78521c4a1 100644
--- a/lib/libc/stdlib/calloc.3
+++ b/lib/libc/stdlib/calloc.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: calloc.3,v 1.4 1999/05/16 19:55:13 alex Exp $
+.\" $OpenBSD: calloc.3,v 1.5 1999/06/29 18:36:19 aaron Exp $
.\"
.Dd June 29, 1991
.Dt CALLOC 3
@@ -48,7 +48,7 @@
.Sh DESCRIPTION
The
.Fn calloc
-function allocates space for an array of
+function allocates space for an array of
.Fa nmemb
objects, each of whose size is
.Fa size .
diff --git a/lib/libc/stdlib/div.3 b/lib/libc/stdlib/div.3
index c766d37fab1..5cc3b8757c8 100644
--- a/lib/libc/stdlib/div.3
+++ b/lib/libc/stdlib/div.3
@@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: div.3,v 1.3 1999/05/16 19:55:14 alex Exp $
+.\" $OpenBSD: div.3,v 1.4 1999/06/29 18:36:19 aaron Exp $
.\"
.Dd April 19, 1991
.Dt DIV 3
@@ -48,11 +48,11 @@ The
.Fn div
function
computes the value
-.Fa num/denom
+.Fa num Ns No / Ns Fa denom
and returns the quotient and remainder in a structure named
.Fa div_t
that contains two
-.Em int
+.Li int
members named
.Fa quot
and
diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3
index 79556f30e87..c7858b55b0d 100644
--- a/lib/libc/stdlib/getenv.3
+++ b/lib/libc/stdlib/getenv.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: getenv.3,v 1.4 1999/05/25 13:06:46 aaron Exp $
+.\" $OpenBSD: getenv.3,v 1.5 1999/06/29 18:36:20 aaron Exp $
.\"
.Dd December 11, 1993
.Dt GETENV 3
@@ -60,10 +60,10 @@ host
.Em environment list .
For compatibility with differing environment conventions,
the given arguments
-.Ar name
+.Fa name
and
-.Ar value
-may be appended and prepended,
+.Fa value
+may be appended and prepended,
respectively,
with an equal sign
.Dq Li \&= .
@@ -71,30 +71,30 @@ with an equal sign
The
.Fn getenv
function obtains the current value of the environment variable,
-.Ar name .
+.Fa name .
If the variable
-.Ar name
+.Fa name
is not in the current environment,
a null pointer is returned.
.Pp
The
.Fn setenv
function inserts or resets the environment variable
-.Ar name
+.Fa name
in the current environment list.
If the variable
-.Ar name
+.Fa name
does not exist in the list,
it is inserted with the given
-.Ar value .
+.Fa value .
If the variable does exist, the argument
-.Ar overwrite
+.Fa overwrite
is tested; if
-.Ar overwrite is
-zero, the
-variable is not reset, otherwise it is reset
+.Fa overwrite
+is zero,
+the variable is not reset, otherwise it is reset
to the given
-.Ar value .
+.Fa value .
.Pp
The
.Fn putenv
@@ -122,7 +122,7 @@ is set to indicate the error and a
.Pp
If
.Fn getenv
-is succesful, the string returned should be considered read-only.
+is succesful, the string returned should be considered read-only.
.Sh ERRORS
.Bl -tag -width [ENOMEM]
.It Bq Er ENOMEM
diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3
index 57d2c3668b8..3c8779d788c 100644
--- a/lib/libc/stdlib/getopt.3
+++ b/lib/libc/stdlib/getopt.3
@@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: getopt.3,v 1.8 1999/05/27 13:09:09 aaron Exp $
+.\" $OpenBSD: getopt.3,v 1.9 1999/06/29 18:36:20 aaron Exp $
.\"
.Dd April 19, 1994
.Dt GETOPT 3
@@ -132,22 +132,25 @@ When all options have been processed (i.e., up to the first non-option
argument),
.Fn getopt
returns \-1.
+.Sh SEE ALSO
+.Xr getopt 1 ,
+.Xr getsubopt 3
.Sh DIAGNOSTICS
If the
.Fn getopt
function encounters a character not found in the string
.Va optstring
or detects
-a missing option argument it writes an error message to
-.Em stderr
+a missing option argument it writes an error message to
+.Em stderr
and returns
.Ql ? .
Setting
.Va opterr
to a zero will disable these error messages.
If
-.Va optstring
-has a leading
+.Va optstring
+has a leading
.Ql \&:
then a missing option argument causes a
.Ql \&:
@@ -202,17 +205,17 @@ function appeared
The
.Fn getopt
function was once specified to return
-.Dv EOF
+.Dv EOF
instead of \-1.
This was changed by
.St -p1003.2-92
-to decouple
+to decouple
.Fn getopt
-from
+from
.Pa <stdio.h> .
.Pp
A single dash
-.Dq Li -
+.Pq Ql -
may be specified as a character in
.Fa optstring ,
however it should
@@ -221,7 +224,7 @@ have an argument associated with it.
This allows
.Fn getopt
to be used with programs that expect
-.Dq Li -
+.Ql -
as an option flag.
This practice is wrong, and should not be used in any current development.
It is provided for backward compatibility
diff --git a/lib/libc/stdlib/getsubopt.3 b/lib/libc/stdlib/getsubopt.3
index 8acc91bdd1b..0ea48864c33 100644
--- a/lib/libc/stdlib/getsubopt.3
+++ b/lib/libc/stdlib/getsubopt.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: getsubopt.3,v 1.2 1998/06/15 17:55:07 mickey Exp $
+.\" $OpenBSD: getsubopt.3,v 1.3 1999/06/29 18:36:20 aaron Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -60,8 +60,7 @@ The argument
is a pointer to a pointer to the string.
The argument
.Fa tokens
-is a pointer to a
-.Dv NULL Ns -terminated
+is a pointer to a null-terminated
array of pointers to strings.
.Pp
The
diff --git a/lib/libc/stdlib/labs.3 b/lib/libc/stdlib/labs.3
index 2d9d6029dbe..de0b76ba1fc 100644
--- a/lib/libc/stdlib/labs.3
+++ b/lib/libc/stdlib/labs.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: labs.3,v 1.3 1999/05/16 19:55:14 alex Exp $
+.\" $OpenBSD: labs.3,v 1.4 1999/06/29 18:36:20 aaron Exp $
.\"
.Dd June 29, 1991
.Dt LABS 3
@@ -50,7 +50,7 @@ The
.Fn labs
function
returns the absolute value of the long integer
-.Ar j .
+.Fa j .
.Sh SEE ALSO
.Xr abs 3 ,
.Xr cabs 3 ,
diff --git a/lib/libc/stdlib/ldiv.3 b/lib/libc/stdlib/ldiv.3
index f5f22881b9b..60b35dc98f3 100644
--- a/lib/libc/stdlib/ldiv.3
+++ b/lib/libc/stdlib/ldiv.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: ldiv.3,v 1.3 1999/05/16 19:55:15 alex Exp $
+.\" $OpenBSD: ldiv.3,v 1.4 1999/06/29 18:36:21 aaron Exp $
.\"
.Dd June 29, 1991
.Dt LDIV 3
@@ -50,15 +50,15 @@ The
.Fn ldiv
function
computes the value
-.Ar num/denom
+.Fa num Ns No / Ns Fa denom
and returns the quotient and remainder in a structure named
-.Ar ldiv_t
+.Li ldiv_t
that contains two
-.Em long integer
+.Li long integer
members named
-.Ar quot
+.Fa quot
and
-.Ar rem .
+.Fa rem .
.Sh SEE ALSO
.Xr div 3 ,
.Xr math 3 ,
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3
index 023a58b8325..e7c237c63a2 100644
--- a/lib/libc/stdlib/malloc.3
+++ b/lib/libc/stdlib/malloc.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: malloc.3,v 1.14 1999/05/27 20:49:35 aaron Exp $
+.\" $OpenBSD: malloc.3,v 1.15 1999/06/29 18:36:21 aaron Exp $
.\"
.Dd August 27, 1996
.Dt MALLOC 3
@@ -113,9 +113,9 @@ If
is a null pointer, the
.Fn realloc
function behaves like the
-.Fn malloc
+.Fn malloc
function for the specified size.
-If the space cannot be allocated, the object
+If the space cannot be allocated, the object
pointed to by
.Fa ptr
is unchanged.
@@ -137,7 +137,7 @@ if ((p = realloc(p, nsize)) == NULL)
.Pp
In most cases, this will result in a leak of memory.
As stated earlier, a return value of
-.Fa NULL
+.Dv NULL
indicates that the old object still remains allocated.
Better code looks like this:
.Bd -literal -offset indent
@@ -163,7 +163,7 @@ Flags are single letters, uppercase means on, lowercase means off.
``abort'' malloc will coredump the process, rather than tolerate failure.
This is a very handy debugging aid, since the core file will represent the
time of failure,
-rather than when the NULL pointer was accessed.
+rather than when the null pointer was accessed.
.Pp
.It D
``dump'' malloc will dump statistics in a file called ``malloc.out'' at exit.
@@ -195,7 +195,7 @@ for all operations.
Consult the source for this one.
.Pp
.It X
-``xmalloc''
+``xmalloc''
rather than return failure,
.Xr abort 3
the program with a diagnostic message on stderr.
@@ -244,15 +244,15 @@ The
function a pointer to the possibly moved allocated space;
otherwise a null pointer is returned.
.Sh MESSAGES
-If
+If
.Fn malloc ,
.Fn free
-or
+or
.Fn realloc
detects an error or warning condition,
a message will be printed to filedescriptor
2 (not using stdio).
-Errors will always result in the process being
+Errors will always result in the process being
.Xr abort 3 'ed.
If the ``A'' option has been specified, warnings will also
.Xr abort 3
@@ -267,9 +267,10 @@ fishy in there. Consult sources and or wizards.
``allocation failed''
if the ``A'' option is specified it is an error for
.Fn malloc
-or
+or
.Fn realloc
-to return NULL.
+to return
+.Dv NULL .
.Pp
``mmap(2) failed, check limits.''
This 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.
The pointer doesn't make sense. It's above the area of memory that
malloc knows something about.
This could be a pointer from some
-.Xr mmap 2 'ed
+.Xr mmap 2 'ed
memory.
.Pp
``junk pointer, too low to make sense.''
@@ -344,7 +345,7 @@ secondary.
.Pp
The main difference from other malloc implementations are believed to be that
the free pages are not accessed until allocated.
-Most malloc implementations will store a data structure containing a,
+Most malloc implementations will store a data structure containing a,
possibly double-, linked list in the free chunks of memory, used to tie
all the free memory together.
That is a quite suboptimal thing to do.
diff --git a/lib/libc/stdlib/qabs.3 b/lib/libc/stdlib/qabs.3
index cdfaa81bf9c..0f7ccdc78f0 100644
--- a/lib/libc/stdlib/qabs.3
+++ b/lib/libc/stdlib/qabs.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: qabs.3,v 1.3 1999/05/16 19:55:16 alex Exp $
+.\" $OpenBSD: qabs.3,v 1.4 1999/06/29 18:36:21 aaron Exp $
.\"
.Dd June 29, 1991
.Dt QABS 3
@@ -50,7 +50,7 @@ The
.Fn qabs
function
returns the absolute value of the quad integer
-.Ar j .
+.Fa j .
.Sh SEE ALSO
.Xr abs 3 ,
.Xr cabs 3 ,
diff --git a/lib/libc/stdlib/qdiv.3 b/lib/libc/stdlib/qdiv.3
index 12aca0b1ea4..127c5812504 100644
--- a/lib/libc/stdlib/qdiv.3
+++ b/lib/libc/stdlib/qdiv.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: qdiv.3,v 1.2 1996/08/19 08:33:41 tholo Exp $
+.\" $OpenBSD: qdiv.3,v 1.3 1999/06/29 18:36:21 aaron Exp $
.\"
.Dd June 29, 1991
.Dt QDIV 3
@@ -50,15 +50,15 @@ The
.Fn qdiv
function
computes the value
-.Ar num/denom
+.Fa num Ns No / Ns Fa denom
and returns the quotient and remainder in a structure named
-.Ar qdiv_t
+.Li qdiv_t
that contains two
-.Em quad integer
+.Li quad integer
members named
-.Ar quot
+.Fa quot
and
-.Ar rem .
+.Fa rem .
.Sh SEE ALSO
.Xr div 3 ,
.Xr ldiv 3 ,
diff --git a/lib/libc/stdlib/qsort.3 b/lib/libc/stdlib/qsort.3
index 0a718244501..8d665187bf6 100644
--- a/lib/libc/stdlib/qsort.3
+++ b/lib/libc/stdlib/qsort.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: qsort.3,v 1.3 1999/02/27 21:56:00 deraadt Exp $
+.\" $OpenBSD: qsort.3,v 1.4 1999/06/29 18:36:22 aaron Exp $
.\"
.Dd June 4, 1993
.Dt QSORT 3
@@ -131,7 +131,7 @@ The function
.Fn mergesort
requires additional memory of size
.Fa nmemb *
-.Fa size
+.Fa size
bytes; it should be used only when space is not at a premium.
.Fn mergesort
is optimized for data with pre-existing order; its worst case
diff --git a/lib/libc/stdlib/radixsort.3 b/lib/libc/stdlib/radixsort.3
index 8b0ea89a0ff..a1a4ee4eabf 100644
--- a/lib/libc/stdlib/radixsort.3
+++ b/lib/libc/stdlib/radixsort.3
@@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: radixsort.3,v 1.4 1998/06/15 17:55:08 mickey Exp $
+.\" $OpenBSD: radixsort.3,v 1.5 1999/06/29 18:36:22 aaron Exp $
.\"
.Dd January 27, 1994
.Dt RADIXSORT 3
@@ -62,8 +62,7 @@ is denoted by the user-specified value
Applications may specify a sort order by providing the
.Fa table
argument.
-If
-.Pf non- Dv NULL ,
+If non-null,
.Fa table
must reference an array of
.Dv UCHAR_MAX
@@ -80,7 +79,9 @@ equally, for example, providing a table with the same weights
for A-Z as for a-z will result in a case-insensitive sort.
If
.Fa table
-is NULL, the contents of the array are sorted in ascending order
+is
+.Dv NULL ,
+the contents of the array are sorted in ascending order
according to the
.Tn ASCII
order 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.
They take linear time relative to the number of bytes in the strings.
.Sh RETURN VALUES
Upon successful completion 0 is returned.
-Otherwise, \-1 is returned and the global variable
+Otherwise, \-1 is returned and the global variable
.Va errno
is set to indicate the error.
.Sh ERRORS
diff --git a/lib/libc/stdlib/rand.3 b/lib/libc/stdlib/rand.3
index 28496ec12aa..d5686e5f4ce 100644
--- a/lib/libc/stdlib/rand.3
+++ b/lib/libc/stdlib/rand.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: rand.3,v 1.5 1998/11/20 11:18:50 d Exp $
+.\" $OpenBSD: rand.3,v 1.6 1999/06/29 18:36:22 aaron Exp $
.\"
.Dd June 29, 1991
.Dt RAND 3
@@ -81,7 +81,7 @@ The
is a thread-safe version of
.Fn rand .
Storage for the seed must be provided through the
-.Ar seed
+.Fa seed
argument, and needs to have been initialized by the caller.
.Sh SEE ALSO
.Xr arc4random 3 ,
diff --git a/lib/libc/stdlib/rand48.3 b/lib/libc/stdlib/rand48.3
index efd64773646..f1615027da6 100644
--- a/lib/libc/stdlib/rand48.3
+++ b/lib/libc/stdlib/rand48.3
@@ -9,7 +9,7 @@
.\" of any kind. I shall in no event be liable for anything that happens
.\" to anyone/anything when using this software.
.\"
-.\" $OpenBSD: rand48.3,v 1.4 1999/03/11 01:35:01 pjanzen Exp $
+.\" $OpenBSD: rand48.3,v 1.5 1999/06/29 18:36:22 aaron Exp $
.\"
.Dd October 8, 1993
.Dt RAND48 3
@@ -27,7 +27,7 @@
.Nd pseudo random number generators and initialization routines
.Sh SYNOPSIS
.Fd #include <stdlib.h>
-.Ft double
+.Ft double
.Fn drand48 void
.Ft double
.Fn erand48 "unsigned short xseed[3]"
diff --git a/lib/libc/stdlib/random.3 b/lib/libc/stdlib/random.3
index 47cdfea9b30..e1ab9e44da9 100644
--- a/lib/libc/stdlib/random.3
+++ b/lib/libc/stdlib/random.3
@@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: random.3,v 1.7 1999/05/23 14:11:03 aaron Exp $
+.\" $OpenBSD: random.3,v 1.8 1999/06/29 18:36:23 aaron Exp $
.\"
.Dd April 19, 1991
.Dt RANDOM 3
@@ -42,7 +42,7 @@
.Nd better random number generator; routines for changing generators
.Sh SYNOPSIS
.Fd #include <stdlib.h>
-.Ft long
+.Ft long
.Fn random void
.Ft void
.Fn srandom "unsigned int seed"
@@ -96,7 +96,7 @@ however,
will by default produce a sequence of numbers that can be duplicated
by calling
.Fn srandom
-with
+with
.Ql 1
as the seed.
.Pp
@@ -167,16 +167,16 @@ messages are printed on the standard error output.
.Xr rand 3
.Sh STANDARDS
The
-.Fn random ,
-.Fn srandom ,
-.Fn initstate ,
+.Fn random ,
+.Fn srandom ,
+.Fn initstate ,
and
.Fn setstate
functions conform to
.St -xpg4.2 .
.Sh HISTORY
These
-functions appeared in
+functions appeared in
.Bx 4.2 .
.Sh BUGS
About 2/3 the speed of
diff --git a/lib/libc/stdlib/realpath.3 b/lib/libc/stdlib/realpath.3
index 7efccbf1b65..814c36ec134 100644
--- a/lib/libc/stdlib/realpath.3
+++ b/lib/libc/stdlib/realpath.3
@@ -32,7 +32,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: realpath.3,v 1.4 1999/05/28 01:57:36 aaron Exp $
+.\" $OpenBSD: realpath.3,v 1.5 1999/06/29 18:36:23 aaron Exp $
.\"
.Dd February, 16, 1994
.Dt REALPATH 3
@@ -67,7 +67,7 @@ refer to a buffer capable of storing at least
.Dv MAXPATHLEN
characters.
.Pp
-The
+The
.Fn realpath
function will resolve both absolute and relative paths
and return the absolute pathname corresponding to
diff --git a/lib/libc/stdlib/strtod.3 b/lib/libc/stdlib/strtod.3
index 14981139c65..6bba73e89a6 100644
--- a/lib/libc/stdlib/strtod.3
+++ b/lib/libc/stdlib/strtod.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: strtod.3,v 1.3 1999/05/27 20:49:35 aaron Exp $
+.\" $OpenBSD: strtod.3,v 1.4 1999/06/29 18:36:23 aaron Exp $
.\"
.Dd June 29, 1991
.Dt STRTOD 3
@@ -50,11 +50,11 @@ string to double
.Sh DESCRIPTION
The
.Fn strtod
-function converts the initial portion of the string
+function converts the initial portion of the string
pointed to by
.Fa nptr
to
-.Em double
+.Li double
representation.
.Pp
The expected form of the string is an optional plus (``+'') or minus
@@ -93,7 +93,7 @@ is stored in
If the correct value would cause underflow, zero is
returned and
.Dv ERANGE
-is stored in
+is stored in
.Va errno .
.Sh ERRORS
.Bl -tag -width Er
diff --git a/lib/libc/stdlib/strtol.3 b/lib/libc/stdlib/strtol.3
index b7d2cd12255..006ba904a57 100644
--- a/lib/libc/stdlib/strtol.3
+++ b/lib/libc/stdlib/strtol.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: strtol.3,v 1.3 1996/08/19 08:33:51 tholo Exp $
+.\" $OpenBSD: strtol.3,v 1.4 1999/06/29 18:36:23 aaron Exp $
.\"
.Dd June 25, 1992
.Dt STRTOL 3
@@ -59,7 +59,7 @@ function
converts the string in
.Fa nptr
to a
-.Em long
+.Li long
value.
The
.Fn strtoq
@@ -67,7 +67,7 @@ function
converts the string in
.Fa nptr
to a
-.Em quad_t
+.Li quad_t
value.
The conversion is done according to the given
.Fa base ,
@@ -95,7 +95,7 @@ is taken as 10 (decimal) unless the next character is
in which case it is taken as 8 (octal).
.Pp
The remainder of the string is converted to a
-.Em long
+.Li long
value in the obvious manner,
stopping at the first character which is not a valid digit
in the given base.
diff --git a/lib/libc/stdlib/strtoul.3 b/lib/libc/stdlib/strtoul.3
index b8234122a2b..3b2a90adc3e 100644
--- a/lib/libc/stdlib/strtoul.3
+++ b/lib/libc/stdlib/strtoul.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: strtoul.3,v 1.2 1996/08/19 08:33:52 tholo Exp $
+.\" $OpenBSD: strtoul.3,v 1.3 1999/06/29 18:36:24 aaron Exp $
.\"
.Dd June 25, 1992
.Dt STRTOUL 3
@@ -59,7 +59,7 @@ function
converts the string in
.Fa nptr
to an
-.Em unsigned long
+.Li unsigned long
value.
The
.Fn strtouq
@@ -67,7 +67,7 @@ function
converts the string in
.Fa nptr
to a
-.Em u_quad_t
+.Li u_quad_t
value.
The conversion is done according to the given
.Fa base ,
@@ -95,7 +95,7 @@ is taken as 10 (decimal) unless the next character is
in which case it is taken as 8 (octal).
.Pp
The remainder of the string is converted to an
-.Em unsigned long
+.Li unsigned long
value in the obvious manner,
stopping at the end of the string
or at the first character that does not produce a valid digit
diff --git a/lib/libc/stdlib/system.3 b/lib/libc/stdlib/system.3
index 985adb07de0..f2d26936779 100644
--- a/lib/libc/stdlib/system.3
+++ b/lib/libc/stdlib/system.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: system.3,v 1.5 1996/12/11 23:09:53 tholo Exp $
+.\" $OpenBSD: system.3,v 1.6 1999/06/29 18:36:24 aaron Exp $
.\"
.Dd June 29, 1991
.Dt SYSTEM 3
@@ -70,18 +70,18 @@ pointer,
will return non-zero.
Otherwise,
.Fn system
-returns the termination status of the shell in the format specified by
+returns the termination status of the shell in the format specified by
.Xr waitpid 2 .
-.Sh RETURN VALUES
+.Sh RETURN VALUES
If a child process cannot be created, or the termination status of
-the shell cannot be obtained,
+the shell cannot be obtained,
.Fn system
-returns -1 and sets
+returns \-1 and sets
.Va errno
to indicate the error.
-If execution of the shell fails,
+If execution of the shell fails,
.Fn system
-returns the termination status for a program that terminates with a call of
+returns the termination status for a program that terminates with a call of
.Fn exit 127 .
.Sh SEE ALSO
.Xr sh 1 ,
@@ -93,6 +93,6 @@ The
.Fn system
function
conforms to
-.St -ansiC
+.St -ansiC
and
.St -p1003.2-92 .
diff --git a/lib/libc/stdlib/tsearch.3 b/lib/libc/stdlib/tsearch.3
index cb8b050e7b7..8456457e272 100644
--- a/lib/libc/stdlib/tsearch.3
+++ b/lib/libc/stdlib/tsearch.3
@@ -23,7 +23,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: tsearch.3,v 1.4 1999/05/10 17:56:28 aaron Exp $
+.\" $OpenBSD: tsearch.3,v 1.5 1999/06/29 18:36:24 aaron Exp $
.\"
.Dd June 15, 1997
.Dt TSEARCH 3
@@ -58,7 +58,8 @@ searches for the datum matched by the argument
.Fa key
in the binary tree rooted at
.Fa rootp ,
-returning a pointer to the datum if it is found and NULL
+returning a pointer to the datum if it is found and
+.Dv NULL
if it is not.
.Pp
.Fn tsearch
@@ -68,7 +69,7 @@ except that if no match is found,
.Fa key
is inserted into the tree and a pointer to it is returned. If
.Fa rootp
-points to a NULL value a new binary search tree is created.
+points to a null value a new binary search tree is created.
.Pp
.Fn tdelete
deletes a node from the specified binary search tree and returns
@@ -89,7 +90,7 @@ and calls the function
on each node.
.Fa action
is called with three arguments: a pointer to the current node,
-a value from the enum
+a value from the enum
.Sy "typedef enum { preorder, postorder, endorder, leaf } VISIT;"
specifying the traversal type, and a node level (where level
zero is the root of the tree).
@@ -99,16 +100,22 @@ zero is the root of the tree).
.Sh RETURN VALUES
The
.Fn tsearch
-function returns NULL if allocation of a new node fails (usually
+function returns
+.Dv NULL
+if allocation of a new node fails (usually
due to a lack of free memory).
.Pp
.Fn tfind ,
.Fn tsearch ,
and
.Fn tdelete
-return NULL if
+return
+.Dv NULL
+if
.Fa rootp
-is NULL or the datum cannot be found.
+is
+.Dv NULL
+or the datum cannot be found.
.Pp
The
.Fn twalk