]> Git Repo - uclibc-ng.git/blame - include/search.h
We already have tar.h, so might as well include cpio.h as well...
[uclibc-ng.git] / include / search.h
CommitLineData
64bc6412
EA
1/* Copyright (C) 1993 Ulrich Drepper
2
3This file is intended to be included in the GNU C Library and the
4Linux C Library. So the copyright notice will be:
5
6
7Copyright (C) 1993 Free Software Foundation, Inc.
8This file is part of the GNU C Library.
9
10The GNU C Library is free software; you can redistribute it and/or
11modify it under the terms of the GNU Library General Public License as
12published by the Free Software Foundation; either version 2 of the
13License, or (at your option) any later version.
14
15The GNU C Library is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18Library General Public License for more details.
19
20You should have received a copy of the GNU Library General Public
21License along with the GNU C Library; see the file COPYING.LIB. If
22not, write to the Free Software Foundation, Inc., 675 Mass Ave,
23Cambridge, MA 02139, USA.
24
25
26For now the file can be distributed under the LGPL. */
27
28#ifndef _SEARCH_H
29#define _SEARCH_H
30
31#include <features.h>
32
33#define __need_size_t
34#define __need_NULL
35#include <stddef.h>
36
cc07f235
MNI
37/* Get __compar_fn_t from stdlib.h */
38#include <stdlib.h>
39
64bc6412
EA
40__BEGIN_DECLS
41
cc07f235 42#if 0
64bc6412
EA
43#ifndef __COMPAR_FN_T
44#define __COMPAR_FN_T
45typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t));
46#endif
cc07f235 47#endif
64bc6412
EA
48
49/* for use with hsearch(3) */
50
51typedef struct entry { char *key; char *data; } ENTRY;
52typedef enum { FIND, ENTER } ACTION;
53
54extern ENTRY * hsearch __P((ENTRY __item, ACTION __action));
55extern int hcreate __P((unsigned __nel));
56extern void hdestroy __P((void));
57
58
59/* The tsearch routines are very interesting. They make many
60 * assumptions about the compiler. It assumpts that the first field
61 * in node must be the "key" field, which points to the datum.
62 * Everything depends on that. It is a very tricky stuff. H.J.
63 */
64/* For tsearch */
65typedef enum { preorder, postorder, endorder, leaf } VISIT;
66
67extern void *tsearch __P((__const void * __key, void **__rootp,
68 __compar_fn_t compar));
69
c886fc91 70extern void *tfind __P((__const void * __key, void * __const * __rootp,
64bc6412
EA
71 __compar_fn_t compar));
72
73extern void *tdelete __P((__const void * __key, void ** __rootp,
74 __compar_fn_t compar));
75
76#ifndef __ACTION_FN_T
77#define __ACTION_FN_T
78/* FYI, the first argument should be a pointer to "key".
79 * Please read the man page for details.
80 */
81typedef void (*__action_fn_t) __P((__const void *__nodep,
82 __const VISIT __value,
83 __const int __level));
84#endif
85
86extern void twalk __P((__const void * __root, __action_fn_t action));
87
88
89extern void * lfind __P((__const void * __key, __const void * __base,
90 size_t * __nmemb, size_t __size,
91 __compar_fn_t __compar));
92
93extern void * lsearch __P((__const void * __key, __const void * __base,
94 size_t * __nmemb, size_t __size,
95 __compar_fn_t __compar));
96
97__END_DECLS
98
99#endif /* search.h */
This page took 0.046939 seconds and 4 git commands to generate.