GENDERS_ISNODE(3)

πŸ’– GENDERS_ISNODE(3) πŸ’–

okay bestie, welcome to the libgenders corner of the universe ✨ this is the LIBGENDERS manual, and we're doing the node / attribute / value check routines today. yes it's three functions in one page, we're being efficient, we love that for us πŸŽ€


✨ NAME ✨

genders_isnode, genders_isattr, genders_isattrval β€” the node, attribute, and value check routines πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <genders.h>

int genders_isnode(genders_t handle, const char *node);

int genders_isattr(genders_t handle, const char *attr);

int genders_isattrval(genders_t handle, const char *attr, const char
*val);

🌸 DESCRIPTION 🌸

so here's the vibe. three little yes/no besties, all here to answer your questions about the genders file πŸ’–

  • genders_isnode() β€” tests if the node pointed to by node is listed in the genders file. and bestie, if node is NULL? it tests the current node instead. no cap ✨
  • genders_isattr() β€” tests if the attribute pointed to by attr is listed for some node in the genders file πŸ‘‘
  • genders_isattrval() β€” tests if the attribute pointed to by attr is equal to the value pointed to by val for some node in the genders file. so like, the attr=val situation, you know the one 🫢

πŸ”₯ RETURN VALUES πŸ”₯

here's the tea on what you get back β˜•

  • For genders_isnode(): if node is listed in the genders file, 1 is returned. if it is not listed, 0 is returned.
  • For genders_isattr(): if attr is listed in the genders file, 1 is returned. if it is not listed, 0 is returned.
  • For genders_isattrval(): if attr=val is listed in the genders file, 1 is returned. if it is not listed, 0 is returned.
and on error? all three of them return -1 😭 and an error code gets returned in handle. you can grab that error code with genders_errnum(3), and a lil description of it with genders_strerror(3). the error codes live in genders.h.

πŸ’€ ERRORS πŸ’€

the ways things can go wrong, a tragic anthology 🎭

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. the genders handle has to be created with genders_handle_create(3) first, bestie, that's the rule πŸ™ˆ
  • GENDERS_ERR_NOTLOADED β€” genders_load_data(3) has not been called to load genders data. no data, no answers, periodt πŸ’…
  • GENDERS_ERR_PARAMETERS β€” an incorrect parameter has been passed in. we don't know her, she's not on the list 🚫
  • GENDERS_ERR_MAGIC β€” handle has an incorrect magic number ✨πŸͺ„ handle does not point to a genders handle, or handle has been destroyed by genders_handle_destroy(3). rip, she's gone πŸ’€

πŸŽ€ FILES πŸŽ€

/usr/include/genders.h

that's the one, that's the file 🌈


πŸ‘‘ SEE ALSO πŸ‘‘

go read these too, they're iconic, i'm obsessed:


and that's the whole page, bestie!! 🫢 this lil masterpiece came from LLNL, dated August 2003 (yes she's vintage, she's a classic, we respect our elders πŸ’œ), and you'll find her filed under GENDERS_ISNODE(3) in the LIBGENDERS manual. mwah, go forth and check your nodes πŸ’…βœ¨πŸŒΈ