Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.4 KiB

  1. /* $OpenBSD: search.h,v 1.5 2002/02/17 19:42:21 millert Exp $ */
  2. /* $NetBSD: search.h,v 1.9 1995/08/08 21:14:45 jtc Exp $ */
  3. /*
  4. * Written by J.T. Conklin <jtc@netbsd.org>
  5. * Public domain.
  6. */
  7. #ifndef _SEARCH_H_
  8. #define _SEARCH_H_
  9. #include <sys/cdefs.h>
  10. #include <machine/ansi.h>
  11. #ifdef _BSD_SIZE_T_
  12. typedef _BSD_SIZE_T_ size_t;
  13. #undef _BSD_SIZE_T_
  14. #endif
  15. typedef struct entry {
  16. char *key;
  17. char *data;
  18. } ENTRY;
  19. typedef enum {
  20. FIND, ENTER
  21. } ACTION;
  22. typedef enum {
  23. preorder,
  24. postorder,
  25. endorder,
  26. leaf
  27. } VISIT;
  28. __BEGIN_DECLS
  29. extern void *bsearch(const void *, const void *, size_t, size_t,
  30. int (*)(const void *, const void *));
  31. extern int hcreate(unsigned int);
  32. extern void hdestroy(void);
  33. extern ENTRY *hsearch(ENTRY, ACTION);
  34. extern void *lfind(const void *, const void *, size_t *, size_t,
  35. int (*)(const void *, const void *));
  36. extern void *lsearch(const void *, const void *, size_t *, size_t,
  37. int (*)(const void *, const void *));
  38. extern void insque(void *, void *);
  39. extern void remque(void *);
  40. extern void *tdelete(const void *, void **,
  41. int (*)(const void *, const void *));
  42. extern void *tfind(const void *, void * const *,
  43. int (*)(const void *, const void *));
  44. extern void *tsearch(const void *, void **,
  45. int (*)(const void *, const void *));
  46. extern void twalk(const void *, void (*)(const void *, VISIT, int));
  47. __END_DECLS
  48. #endif