]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/hsearch.3
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
[thirdparty/man-pages.git] / man3 / hsearch.3
index b89d0904146333694d4dcc87417633c01d88dc99..98d866b52fbc4cad350843bc0bfd1e2aca3b6da9 100644 (file)
@@ -46,7 +46,7 @@ hcreate, hdestroy, hsearch \- hash table management
 .sp
 .BI "int hcreate_r(size_t " nel ", struct hsearch_data *" tab );
 .sp
-.BI "int hsearch_r(ENTRY " item ", ACTION " action ", ENTRY **" ret , 
+.BI "int hsearch_r(ENTRY " item ", ACTION " action ", ENTRY **" ret ,
 .BI "              struct hsearch_data *" tab );
 .sp
 .BI "void hdestroy_r(struct hsearch_data *" tab );
@@ -74,9 +74,9 @@ The argument \fIitem\fP is of type \fBENTRY\fP, which is a typedef defined in
 .RS
 .sp
 .nf
-typedef struct entry { 
+typedef struct entry {
     char *\fIkey\fP;
-    void *\fIdata\fP; 
+    void *\fIdata\fP;
 } ENTRY;
 .RE
 .fi
@@ -89,7 +89,8 @@ item with the same key as \fIitem\fP (where "the same" is determined using
 .BR strcmp (3)),
 and if successful returns a pointer to it.
 The argument \fIaction\fP determines what \fBhsearch\fP() does
-after an unsuccessful search.  A value of \fBENTER\fP instructs it to
+after an unsuccessful search.
+A value of \fBENTER\fP instructs it to
 insert a copy of \fIitem\fP, while a value of \fBFIND\fP means to return
 NULL.
 .PP
@@ -98,7 +99,8 @@ The three functions
 .BR hsearch_r (),
 .BR hdestroy_r ()
 are reentrant versions that allow the use of more than one table.
-The last argument used identifies the table. The struct it points to
+The last argument used identifies the table.
+The struct it points to
 must be zeroed before the first call to
 .BR hcreate_r ().
 .SH "RETURN VALUE"
@@ -140,7 +142,8 @@ are GNU extensions.
 .SH BUGS
 SVr4 and POSIX.1-2001 specify that \fIaction\fP
 is significant only for unsuccessful searches, so that an ENTER
-should not do anything for a successful search. The libc and glibc
+should not do anything for a successful search.
+The libc and glibc
 implementations update the \fIdata\fP for the given \fIkey\fP
 in this case.
 .\" Tue Jan 29 09:27:40 2002: fixed in latest glibc snapshot
@@ -155,25 +158,25 @@ some of them.
 #include <stdio.h>
 #include <stdlib.h>
 #include <search.h>
-    
+
 char *data[] = { "alpha", "bravo", "charlie", "delta",
      "echo", "foxtrot", "golf", "hotel", "india", "juliet",
      "kilo", "lima", "mike", "november", "oscar", "papa",
      "quebec", "romeo", "sierra", "tango", "uniform",
-     "victor", "whisky", "x-ray", "yankee", "zulu" 
+     "victor", "whisky", "x-ray", "yankee", "zulu"
 };
 
-int 
-main(void) 
+int
+main(void)
 {
     ENTRY e, *ep;
     int i;
-    
+
     /* starting with small table, and letting it grow does not work */
     hcreate(30);
     for (i = 0; i < 24; i++) {
-        e.key = data[i]; 
-        /* data is just an integer, instead of a 
+        e.key = data[i];
+        /* data is just an integer, instead of a
            pointer to something */
         e.data = (void *)i;
         ep = hsearch(e, ENTER);