GENDERS_GETATTR(3)

πŸ“¦
version 1.28.1~^20231119git27b915d Β· 4 versions
, in epel 10, fedora 43, fedora 44

πŸ’– GENDERS_GETATTR(3) πŸ’–

okay bestie, welcome to the LIBGENDERS section of the manual β€” yes, section 3, the library one, we're fancy like that ✨


🌸 NAME 🌸

genders_getattr β€” bestie, we're getting attributes out of a genders file. that's the whole job. slay.


πŸŽ€ SYNOPSIS πŸŽ€

#include <genders.h>

int genders_getattr(genders_t handle, char *attrs[], char *vals[], int
len, const char *node);

πŸ¦‹ DESCRIPTION πŸ¦‹

so genders_getattr() pulls the attributes and values for the node that node is pointing at. like, it's giving data retrieval, it's giving main character energy πŸ’…

if node is NULL, no worries β€” you just get the attributes and values for the current node instead. easy.

the attributes land in the attribute list that attrs points to, and the attribute values land in vals. and if you genuinely do not want the values? set vals to NULL and we move on. iconic behaviour honestly.

len is you telling the function how many elements can fit in both the attribute list and the attribute values list. don't lie to it, bestie, it will not go well (see GENDERS_ERR_OVERFLOW below 😭).

and listen β€” to avoid passing in a list that's simply not big enough to hold every attribute and value, you should use genders_getmaxattrs(3) to figure out the minimum number of elements that attrs and vals need to be able to store. OR, even cuter, you can use genders_attrlist_create(3) and genders_vallist_create(3) to make lists that are guaranteed to be big enough for all the attributes and attribute values. no guessing, no overflow, no crying. obsessed 🫢


⭐ RETURN VALUES ⭐

  • on success: the number of attributes stored in attrs gets returned. periodt.
  • on error: -1 comes back, and an error code gets put into handle. you can grab that error code with genders_errnum(3), and get a description of it with genders_strerror(3). error codes are defined in genders.h β€” that's where they live, that's their home 🏠

πŸ’€ ERRORS πŸ’€

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. bestie. the genders handle has to be created with genders_handle_create(3) first, you can't just show up with nothing.
  • GENDERS_ERR_NOTLOADED β€” genders_load_data(3) hasn't been called to load the genders data. no data loaded, no vibes.
  • GENDERS_ERR_OVERFLOW β€” the list pointed to by attrs or vals isn't big enough to store all the attributes or attribute values. it's giving "too much information, not enough container" 😭
  • GENDERS_ERR_PARAMETERS β€” an incorrect parameter got passed in. oops.
  • GENDERS_ERR_NULLPTR β€” a null pointer was found in the list that got passed in. found one. lurking. πŸ•΅οΈ
  • GENDERS_ERR_NOTFOUND β€” the node pointed to by node can't be found in the genders file, OR if node=NULL, the machine that genders is running on isn't listed in the genders database. it's just not there, bestie.
  • GENDERS_ERR_MAGIC β€” handle has an incorrect magic number. meaning: handle doesn't point to a genders handle at all, or it did and it got destroyed by genders_handle_destroy(3). rip to that handle πŸͺ¦

🌈 FILES 🌈

  • /usr/include/genders.h

πŸ‘‘ SEE ALSO πŸ‘‘

libgenders(3), genders_handle_create(3), genders_load_data(3), genders_getmaxattrs(3), genders_attrlist_create(3), genders_vallist_create(3), genders_errnum(3), genders_strerror(3)


πŸ’œ and that's the whole page! go forth and get those attributes, bestie. iykyk ✨

and finally, the cute little sign-off β€” this one came from LLNL, dated August 2003, living in the LIBGENDERS manual. vintage but make it slay πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from