GENDERS_TESTATTR(3)
π GENDERS_TESTATTR π
okay bestie, so this is genders_testattr(3) from LIBGENDERS β yes, the library is literally called libgenders, we don't make the rules, we just slay within them π«Ά
This whole page is your cheat sheet for asking "hey, does this node have this attribute or not??" and getting an actual answer instead of vibes.
β¨ NAME β¨
genders_testattr β test if a node has an attribute. That's it, that's the whole job, and honestly? iconic π
πΈ SYNOPSIS πΈ
#include <genders.h>
int genders_testattr(genders_t handle, const char *node, const char *attr,
char *val, int len);
int genders_testattrval(genders_t handle, const char *node, const char *attr,
const char *val);
two functions, one vibe. let's get into it π¦
π DESCRIPTION π
genders_testattr()
so this one tests if the node pointed to by node contains the attribute pointed to by attr. simple. clean. gorgeous.
- if
nodeisNULL, then bestie, we test the current node instead. no node? no problem πββοΈ - if the attribute is found, its value gets stored in the buffer pointed to by
val lenshould indicate the length of that buffer. don't lie to it. it knows.- if you don't actually need the attribute value, you can set
valtoNULLβ zero drama, we just check existence π
okay so, real talk: to avoid passing in an attribute value buffer that is not large enough to store the attribute value, you should use genders_getmaxvallen(3) to determine the minimum buffer size you should be using. do not skip this. do not eyeball it. do not manifest a bigger buffer. it will not work π
genders_testattrval()
this one is the overachiever of the two β¨ it tests if the node pointed to by node contains the attribute pointed to by attr and if that attribute is equal to the attribute value pointed to by val.
- if
valisNULL, only the attribute is tested. lowkey just becomesgenders_testattr()at that point, and we respect the versatility.
π₯ RETURN VALUES π₯
for genders_testattr()
- if the node contains the attribute,
1is returned π 0is returned if the node does not contain the attribute π
for genders_testattrval()
- if the node contains the attribute and it is equal to the attribute value,
1is returned π 0is returned if the node does not contain the attribute, or if the attribute is not equal to the attribute value π€
for BOTH genders_testattr() and genders_testattrval()
-1is returned on error, and an error code is returned inhandle- that error code can be retrieved via
genders_errnum(3)β go get it, girl - a description of the error code can be retrieved via
genders_strerror(3) - error codes are defined in
genders.h
π ERRORS π
here's the whole roster of ways things can go sideways. memorize them, they're your enemies now π
GENDERS_ERR_NULLHANDLEβ thehandleparameter isNULL. bestie. the genders handle must be created withgenders_handle_create(3). you cannot test attributes with nothing. that's not a handle, that's a void πGENDERS_ERR_NOTLOADEDβgenders_load_data(3)has not been called to load genders data. the data isn't there. it's giving empty fridge energy πGENDERS_ERR_OVERFLOWβ the buffer pointed to byvalis not large enough to store the attribute value. this is the onegenders_getmaxvallen(3)was trying to warn you about. should've listened πGENDERS_ERR_PARAMETERSβ an incorrect parameter has been passed in. wrong vibes, wrong input, rejected.GENDERS_ERR_NOTFOUNDβ the node pointed to bynodecannot be found in the genders file, or ifnode=NULL, the machine genders is running on is not listed in the genders database. it's not in the group chat. it was never added. πGENDERS_ERR_MAGICβhandlehas an incorrect magic number. sohandledoes not point to a genders handle, orhandlehas been destroyed bygenders_handle_destroy(3). the magic is gone, and not in the cute way β¨
π FILES π
/usr/include/genders.h
π SEE ALSO π
libgenders(3), genders_handle_create(3), genders_load_data(3), genders_getmaxvallen(3), genders_errnum(3), genders_strerror(3)
go read those too, they're all part of the same friend group, iykyk π
and that's the whole page, bestie!! this one came from LLNL and it's been holding it down since August 2003 β yes, this manpage is older than most of us and it still ate π«Άβ¨ periodt.
π¦ where this page comes from
- epel 10: libgenders-devel 1.28.1~^20231119git27b915d-5.el10_2 Β· GPL-2.0-only
- fedora 43: libgenders-devel 1.28.1~^20231119git27b915d-5.fc43 Β· GPL-2.0-only
- fedora 43: libgenders-devel 1.28.1~^20231119git27b915d-5.fc43 Β· GPL-2.0-only
- fedora 44: libgenders-devel 1.28.1~^20231119git27b915d-6.fc44 Β· GPL-2.0-only
- fedora 44: libgenders-devel 1.28.1~^20231119git27b915d-6.fc44 Β· GPL-2.0-only
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- Copyright (C) 2007-2019 Lawrence Livermore National Security, LLC
- Copyright (C) 2001-2007 The Regents of the University of California
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms