GENDERS_TESTATTR(3)
π GENDERS_TESTATTR(3) β LIBGENDERS π
okay bestie, pull up a chair, we're doing libgenders section 3 today π
β¨ NAME β¨
genders_testattr β literally just: does this node have this attribute or not? that's the whole vibe check π¦
πΈ 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);
π DESCRIPTION π
so. genders_testattr() asks the big question: does the node that node points at contain the attribute that attr points at? π«Ά and if node is NULL? no worries, it just tests the current node, main character energy fr.
if the attribute IS found, its value gets stashed in the buffer that val points to. and len? that's you telling it how long that buffer is, no cap. don't actually need the value? set val to NULL and move on, iconic.
π¨ bestie listen: 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 figure out the minimum buffer size you should be using. do not skip this. i'm begging.
genders_testattrval() goes one step further β 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. and if val is NULL? then it only tests the attribute itself, simple as π
β RETURN VALUES β
for genders_testattr():
- if the node contains the attribute β
1is returned π - if the node does not contain the attribute β
0is returned
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
and for both genders_testattr() and genders_testattrval(): -1 is returned on error π and an error code is returned in handle. you can grab that error code with genders_errnum(3), and get a lil description of it with genders_strerror(3). error codes are defined in genders.h, iykyk.
π ERRORS π
GENDERS_ERR_NULLHANDLEβ thehandleparameter isNULL. the genders handle has to be created withgenders_handle_create(3)first, babe.GENDERS_ERR_NOTLOADEDβgenders_load_data(3)has not been called to load genders data. nothing loaded, nothing to test π«GENDERS_ERR_OVERFLOWβ the buffer pointed to byvalis not large enough to store the attribute value. told you to callgenders_getmaxvallen(3)πGENDERS_ERR_PARAMETERSβ an incorrect parameter has been passed in.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. ghosted πGENDERS_ERR_MAGICβhandlehas an incorrect magic number. eitherhandledoes not point to a genders handle, orhandlehas been destroyed bygenders_handle_destroy(3). it's giving expired β¨
π 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)
and that's the whole page, bestie!! πβ¨ this one's brought to you by LLNL, dated August 2003 (yes she's vintage, vintage is chic π ), living in the LIBGENDERS manual, section 3. go test some attributes, you absolute icon ππ
π¦ 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