search.h(0P)

🌸 PROLOG 🌸

ok so before literally anything else: this manual page is part of the POSIX Programmer's Manual, bestie. that's the vibe. πŸ’–

but heads up β€” the Linux implementation of this interface may differ. so if you're on Linux, go consult the corresponding Linux manual page for the deets on Linux behavior. or, plot twist, the interface might not even be implemented on Linux at all. πŸ’€ no cap. check first.


✨ NAME ✨

search.h β€” search tables 🫢

like, the header that handles your searching-and-tabling business. iconic.


πŸŽ€ SYNOPSIS πŸŽ€

#include <search.h>

that's it. that's the whole synopsis. one line. main character energy fr. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea. πŸ“

The <search.h> header shall define the ENTRY type for structure entry, and that structure shall include these members:

char    *key
void    *data

and it shall define ACTION and VISIT as enumeration data types, through type definitions, like this:

enum { FIND, ENTER } ACTION;
enum { preorder, postorder, endorder, leaf } VISIT;

The <search.h> header shall define the size_t type as described in <sys/types.h>. yes bestie, it's giving teamwork. 🀝

now β€” the following shall be declared as functions, and they may also be defined as macros. Function prototypes shall be provided. no shortcuts, periodt.

int    hcreate(size_t);
void   hdestroy(void);
ENTRY *hsearch(ENTRY, ACTION);
void   insque(void *, void *);
void  *lfind(const void *, const void *, size_t *,
          size_t, int (*)(const void *, const void *));
void  *lsearch(const void *, void *, size_t *,
          size_t, int (*)(const void *, const void *));
void   remque(void *);
void  *tdelete(const void *restrict, void **restrict,
          int(*)(const void *, const void *));
void  *tfind(const void *, void *const *,
          int(*)(const void *, const void *));
void  *tsearch(const void *, void **,
          int(*)(const void *, const void *));
void   twalk(const void *,
          void (*)(const void *, VISIT, int ));

and then, plot twist: the following sections are informative. yes, informative β€” not normative. the vibe shifts, the rules relax. 🧚


πŸ’œ APPLICATION USAGE πŸ’œ

None.

literally nothing. empty. a void. the silence is loud. 😭


πŸ’… RATIONALE πŸ’…

None.

again β€” nothing. no thoughts, head empty, as the philosophers say. πŸ™ˆ


🌈 FUTURE DIRECTIONS 🌈

None.

the future is bright and also completely unspecified. slay. ⭐


πŸ‘‘ SEE ALSO πŸ‘‘

  • <sys_types.h>
  • The System Interfaces volume of POSIX.1‐2017, hcreate(), insque(), lsearch(), tdelete()

go read those next, bestie, iykyk. πŸ”₯


ok so legally speaking, portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. πŸ’œ

and like, if there's ever a discrepancy between this version and the original IEEE and The Open Group Standard β€” bestie, the original IEEE and The Open Group Standard is the referee document. no debating, that's the final say. periodt.

the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

also: any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. so like, not our fault, but to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . 🫢


and that's the whole page, angel. this one came from IEEE/The Open Group, 2017, and it's page search.h(0P) in the POSIX Programmer's Manual. go forth and search those tables. πŸŒΈπŸ’–βœ¨

πŸ“¦ where this page comes from