summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/a64l.37
-rw-r--r--lib/libc/stdlib/exit.35
-rw-r--r--lib/libc/stdlib/getopt_long.356
-rw-r--r--lib/libc/stdlib/hcreate.318
-rw-r--r--lib/libc/stdlib/malloc.324
-rw-r--r--lib/libc/stdlib/random.38
-rw-r--r--lib/libc/stdlib/tsearch.38
7 files changed, 71 insertions, 55 deletions
diff --git a/lib/libc/stdlib/a64l.3 b/lib/libc/stdlib/a64l.3
index a440e87b6ac..0b59293640a 100644
--- a/lib/libc/stdlib/a64l.3
+++ b/lib/libc/stdlib/a64l.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: a64l.3,v 1.6 2002/02/07 07:00:27 ross Exp $
+.\" $NetBSD: a64l.3,v 1.7 2002/10/01 17:29:22 wiz Exp $
.\"
.\" Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -128,8 +128,9 @@ Multithreading Extension.
.Sh BUGS
The
.Fn l64a
-function is not reentrant. The value returned by it points into a
-static buffer area; subsequent calls to
+function is not reentrant.
+The value returned by it points into a static buffer area;
+subsequent calls to
.Fn la64a
may overwrite this buffer.
In multi-threaded applications,
diff --git a/lib/libc/stdlib/exit.3 b/lib/libc/stdlib/exit.3
index d77d22fd0fa..2805e0a1866 100644
--- a/lib/libc/stdlib/exit.3
+++ b/lib/libc/stdlib/exit.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: exit.3,v 1.10 2002/08/10 17:10:11 yamt Exp $
+.\" $NetBSD: exit.3,v 1.11 2002/10/01 17:29:22 wiz Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -51,7 +51,8 @@
.Fn exit "int status"
.Sh DESCRIPTION
.Fn exit
-terminates a process. The
+terminates a process.
+The
.Fa status
values
.Dv EXIT_SUCCESS
diff --git a/lib/libc/stdlib/getopt_long.3 b/lib/libc/stdlib/getopt_long.3
index a2e08a778c6..c5c3dbfc265 100644
--- a/lib/libc/stdlib/getopt_long.3
+++ b/lib/libc/stdlib/getopt_long.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: getopt_long.3,v 1.8 2002/06/03 12:01:43 wiz Exp $
+.\" $NetBSD: getopt_long.3,v 1.9 2002/10/01 17:29:22 wiz Exp $
.\"
.\" Copyright (c) 1988, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -50,15 +50,17 @@ The
.Fn getopt_long
function is similar to
.Xr getopt 3
-but it accepts options in two forms: words and characters. The
+but it accepts options in two forms: words and characters.
+The
.Fn getopt_long
function provides a superset of of the functionality of
.Xr getopt 3 .
.Fn getopt_long
-can be used in two ways. In the first way, every long option understood
-by the program has a corresponding short option, and the option
-structure is only used to translate from long options to short
-options. When used in this fashion,
+can be used in two ways.
+In the first way, every long option understood by the program has a
+corresponding short option, and the option structure is only used to
+translate from long options to short options.
+When used in this fashion,
.Fn getopt_long
behaves identically to
.Xr getopt 3 .
@@ -70,27 +72,28 @@ In the second mechanism, a long option sets a flag in the
structure passed, or will store a pointer to the command line argument
in the
.Fa option
-structure passed to it for options that take arguments. Additionally,
-the long option's argument may be specified as a single argument with
-an equal sign, e.g.
+structure passed to it for options that take arguments.
+Additionally, the long option's argument may be specified as a single
+argument with an equal sign, e.g.
.Bd -literal
myprogram --myoption=somevalue
.Ed
.Pp
When a long option is processed the call to
.Fn getopt_long
-will return 0. For this reason, long option processing without
+will return 0.
+For this reason, long option processing without
shortcuts is not backwards compatible with
.Xr getopt 3 .
.Pp
It is possible to combine these methods, providing for long options
-processing with short option equivalents for some options. Less
-frequently used options would be processed as long options only.
+processing with short option equivalents for some options.
+Less frequently used options would be processed as long options only.
.Pp
The
.Fn getopt_long
-call requires a structure to be initialized describing the long
-options. The structure is:
+call requires a structure to be initialized describing the long options.
+The structure is:
.Bd -literal
struct option {
char *name;
@@ -121,11 +124,13 @@ If
is non-NULL, then the integer pointed to by it will be set to the
value in the
.Fa val
-field. If the
+field.
+If the
.Fa flag
field is NULL, then the
.Fa val
-field will be returned. Setting
+field will be returned.
+Setting
.Fa flag
to NULL and setting
.Fa val
@@ -209,8 +214,8 @@ handling of --a in getopt:
.It Li GNU
parses this as option '-', option 'a'.
.It Li NetBSD
-parses this as '--', and returns -1 (ignoring the a). (Because
-the original getopt does.)
+parses this as '--', and returns -1 (ignoring the a).
+(Because the original getopt does.)
.El
.It Li o
setting of optopt for long options with flag != NULL:
@@ -248,24 +253,25 @@ long option (W; in option string):
returns -W with optarg set to the unknown option.
.It Li NetBSD
treats this as an error (unknown option) and returns '?' with
-optopt set to 0 and optarg set to NULL (as GNU's man page
-documents).
+optopt set to 0 and optarg set to NULL (as GNU's man page documents).
.El
.It Li o
The error messages are different.
.It Li o
NetBSD does not permute the argument vector at the same points in
-the calling sequence as GNU does. The aspects normally used by
-the caller (ordering after -1 is returned, value of optind relative
-to current positions) are the same, though. (We do fewer variable
-swaps.)
+the calling sequence as GNU does.
+The aspects normally used by the caller
+(ordering after -1 is returned, value of optind relative
+to current positions) are the same, though.
+(We do fewer variable swaps.)
.El
.Sh SEE ALSO
.Xr getopt 3
.Sh HISTORY
The
.Fn getopt_long
-function first appeared in GNU libiberty. The first
+function first appeared in GNU libiberty.
+The first
.Nx
implementation appeared in 1.5.
.Sh BUGS
diff --git a/lib/libc/stdlib/hcreate.3 b/lib/libc/stdlib/hcreate.3
index cca71fd0cb7..ee49f5a9b75 100644
--- a/lib/libc/stdlib/hcreate.3
+++ b/lib/libc/stdlib/hcreate.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: hcreate.3,v 1.4 2002/02/07 07:00:29 ross Exp $
+.\" $NetBSD: hcreate.3,v 1.5 2002/10/01 17:29:23 wiz Exp $
.\"
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -66,8 +66,8 @@ function allocates and initializes the table.
The
.Fa nel
argument specifies an estimate of the maximum number of entries to be held
-by the table. Unless further memory allocation fails, supplying an
-insufficient
+by the table.
+Unless further memory allocation fails, supplying an insufficient
.Fa nel
value will not result in functional harm, although a performance degradation
may occur.
@@ -86,8 +86,10 @@ the data can no longer be accessed.
.Pp
The
.Fn hsearch
-function is used to search to the hash table. It returns a pointer into the
-hash table indicating the address of an item. The
+function is used to search to the hash table.
+It returns a pointer into the
+hash table indicating the address of an item.
+The
.Fa item
argument is of type
.Dv ENTRY ,
@@ -122,7 +124,8 @@ and
.Fa data
elements of
.Fa item
-are used directly by the new table entry. The storage for the
+are used directly by the new table entry.
+The storage for the
key must not be modified during the lifetime of the hash table.
.It Dv FIND
Search the hash table without inserting
@@ -131,7 +134,8 @@ Search the hash table without inserting
.Sh RETURN VALUES
If successful, the
.Fn hcreate
-function returns a non-zero value. Otherwise, a value of 0 is returned and
+function returns a non-zero value.
+Otherwise, a value of 0 is returned and
.Va errno
is set to indicate the error.
.Pp
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3
index 09d8026d324..6631fe635f3 100644
--- a/lib/libc/stdlib/malloc.3
+++ b/lib/libc/stdlib/malloc.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: malloc.3,v 1.17 2002/08/20 16:15:38 wiz Exp $
+.\" $NetBSD: malloc.3,v 1.18 2002/10/01 17:29:23 wiz Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -214,8 +214,8 @@ option.
This is intended for debugging and will impact performance negatively.
.It H
Pass a hint to the kernel about pages unused by the allocation functions.
-This will help performance if the system is paging excessively. This
-option is off by default.
+This will help performance if the system is paging excessively.
+This option is off by default.
.It R
Causes the
.Fn realloc
@@ -356,8 +356,8 @@ done by a process.
.Ed
.Pp
A side effect of this architecture is that many minor transgressions on
-the interface which would traditionally not be detected are in fact
-detected. As a result, programs that have been running happily for
+the interface which would traditionally not be detected are in fact detected.
+As a result, programs that have been running happily for
years may suddenly start to complain loudly, when linked with this
allocation implementation.
.Pp
@@ -371,9 +371,9 @@ It is probably also a good idea to recompile the program with suitable
options and symbols for debugger support.
.Pp
If the program starts to give unusual results, coredump or generally behave
-differently without emitting any of the messages listed in the next
-section, it is likely because it depends on the storage being filled with
-nul bytes. Try running it with
+differently without emitting any of the messages listed in the next section,
+it is likely because it depends on the storage being filled with nul bytes.
+Try running it with
.Dq Z
option set;
if that improves the situation, this diagnosis has been confirmed.
@@ -459,8 +459,8 @@ or
is trying to free does not reference a possible page.
.It "recursive call
A process has attempted to call an allocation function recursively.
-This is not permitted. In particular, signal handlers should not
-attempt to allocate memory.
+This is not permitted.
+In particular, signal handlers should not attempt to allocate memory.
.It "out of memory
The
.Dq X
@@ -489,8 +489,8 @@ functions conform to
.Sh HISTORY
The present allocation implementation started out as a filesystem for a
drum attached to a 20bit binary challenged computer which was built
-with discrete germanium transistors. It has since graduated to
-handle primary storage rather than secondary.
+with discrete germanium transistors.
+It has since graduated to handle primary storage rather than secondary.
It first appeared in its new shape and ability in
.Fx 2.2 , and then in
.Nx 1.5 .
diff --git a/lib/libc/stdlib/random.3 b/lib/libc/stdlib/random.3
index 867244d99ef..e0b745b214d 100644
--- a/lib/libc/stdlib/random.3
+++ b/lib/libc/stdlib/random.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: random.3,v 1.15 2002/02/07 09:24:07 ross Exp $
+.\" $NetBSD: random.3,v 1.16 2002/10/01 17:29:23 wiz Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -112,9 +112,11 @@ the nearest known amount.
Using less than 8 bytes will cause an error).
The seed for the initialization (which specifies a starting point for
the random number sequence, and provides for restarting at the same
-point) is also an argument. The state array passed to
+point) is also an argument.
+The state array passed to
.Fn initstate
-must be aligned to a 32-bit boundary. This can be achieved by using
+must be aligned to a 32-bit boundary.
+This can be achieved by using
a suitably-sized array of ints, and casting the array to char * when
passing it to
.Fn initstate .
diff --git a/lib/libc/stdlib/tsearch.3 b/lib/libc/stdlib/tsearch.3
index 620c237e92d..d6b1711594c 100644
--- a/lib/libc/stdlib/tsearch.3
+++ b/lib/libc/stdlib/tsearch.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: tsearch.3,v 1.3 2002/02/07 07:00:30 ross Exp $
+.\" $NetBSD: tsearch.3,v 1.4 2002/10/01 17:29:24 wiz Exp $
.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
.\" All rights reserved.
.\"
@@ -50,7 +50,8 @@ The
and
.Fn twalk
functions manage binary search trees based on algorithms T and D
-from Knuth (6.2.2). The comparison function passed in by
+from Knuth (6.2.2).
+The comparison function passed in by
the user has the same style of return values as
.Xr strcmp 3 .
.Pp
@@ -67,7 +68,8 @@ is identical to
.Fn tfind
except that if no match is found,
.Fa key
-is inserted into the tree and a pointer to it is returned. If
+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.
.Pp