diff options
Diffstat (limited to 'src/lib/libc/stdlib/tsearch.3')
-rw-r--r-- | src/lib/libc/stdlib/tsearch.3 | 21 |
1 files changed, 14 insertions, 7 deletions
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 |
59 | in the binary tree rooted at | 59 | in the binary tree rooted at |
60 | .Fa rootp , | 60 | .Fa rootp , |
61 | returning a pointer to the datum if it is found and NULL | 61 | returning a pointer to the datum if it is found and |
62 | .Dv NULL | ||
62 | if it is not. | 63 | if 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 |
69 | is inserted into the tree and a pointer to it is returned. If | 70 | is inserted into the tree and a pointer to it is returned. If |
70 | .Fa rootp | 71 | .Fa rootp |
71 | points to a NULL value a new binary search tree is created. | 72 | points to a null value a new binary search tree is created. |
72 | .Pp | 73 | .Pp |
73 | .Fn tdelete | 74 | .Fn tdelete |
74 | deletes a node from the specified binary search tree and returns | 75 | deletes a node from the specified binary search tree and returns |
@@ -89,7 +90,7 @@ and calls the function | |||
89 | on each node. | 90 | on each node. |
90 | .Fa action | 91 | .Fa action |
91 | is called with three arguments: a pointer to the current node, | 92 | is called with three arguments: a pointer to the current node, |
92 | a value from the enum | 93 | a value from the enum |
93 | .Sy "typedef enum { preorder, postorder, endorder, leaf } VISIT;" | 94 | .Sy "typedef enum { preorder, postorder, endorder, leaf } VISIT;" |
94 | specifying the traversal type, and a node level (where level | 95 | specifying the traversal type, and a node level (where level |
95 | zero is the root of the tree). | 96 | zero 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 |
100 | The | 101 | The |
101 | .Fn tsearch | 102 | .Fn tsearch |
102 | function returns NULL if allocation of a new node fails (usually | 103 | function returns |
104 | .Dv NULL | ||
105 | if allocation of a new node fails (usually | ||
103 | due to a lack of free memory). | 106 | due to a lack of free memory). |
104 | .Pp | 107 | .Pp |
105 | .Fn tfind , | 108 | .Fn tfind , |
106 | .Fn tsearch , | 109 | .Fn tsearch , |
107 | and | 110 | and |
108 | .Fn tdelete | 111 | .Fn tdelete |
109 | return NULL if | 112 | return |
113 | .Dv NULL | ||
114 | if | ||
110 | .Fa rootp | 115 | .Fa rootp |
111 | is NULL or the datum cannot be found. | 116 | is |
117 | .Dv NULL | ||
118 | or the datum cannot be found. | ||
112 | .Pp | 119 | .Pp |
113 | The | 120 | The |
114 | .Fn twalk | 121 | .Fn twalk |