GENDERS_GETNODES(3)
β¨ GENDERS_GETNODES β¨
okay bestie, listen up β this is the genders_getnodes page from section 3 of the LIBGENDERS manual, and it's genuinely one of the most useful little functions in the whole library. Let's get into it π
πΈ NAME πΈ
genders_getnodes β literally just: get nodes from the genders file π¦
β¨ SYNOPSIS β¨
#include <genders.h>
int genders_getnodes(genders_t handle, char *nodes[], int len, const
char *attr, const char *val);
π DESCRIPTION π
So here's the tea, bestie π«: genders_getnodes() grabs the names of the nodes in the genders file that have the attribute specified by attr and the value specified by val.
Those node names get stashed in the list pointed to by nodes. And len? That's how many nodes you can actually fit in that list. Like, the capacity. Don't be out here lying about it π₯
Couple of special cases, and they're iconic:
- If
attrisNULL,genders_getnodes()returns all the nodes listed in the genders file. Every single one. The whole roster π - If
valisNULL, attribute values are ignored. So it's like "idc what the value is, just gimme the nodes that have this attribute."
π«Ά Pro tip from someone who cares about you: to avoid passing in a list that is NOT large enough to store all the nodes (the classic oopsie), you should usegenders_getnumnodes(3)to figure out the minimum number of elementsnodesneeds to be able to store. Or β even cuter βgenders_nodelist_create(3)can be used to create a list that's guaranteed to be large enough to store all of the nodes. No math, no panic. Slay π
π RETURN VALUES π
On success: you get back the number of nodes stored in nodes. Yay! β¨
On error: -1 comes back, and an error code gets returned in handle. You can retrieve that error code with genders_errnum(3), and a description of the error code with genders_strerror(3). The error codes themselves are defined in genders.h π
π ERRORS π
Not me listing every single one, but like⦠every single one matters, bestie. Here we go:
GENDERS_ERR_NULLHANDLEβ thehandleparameter isNULL. The genders handle must be created withgenders_handle_create(3). You cannot skip this step, I'm so serious πGENDERS_ERR_NOTLOADEDβgenders_load_data(3)has not been called to load genders data. No data, no nodes, no vibes.GENDERS_ERR_OVERFLOWβ the list pointed to bynodesis not large enough to store all the nodes. She's giving "I brought a tote bag to a Costco run" ποΈGENDERS_ERR_PARAMETERSβ an incorrect parameter has been passed in. Wrong input, wrong energy πGENDERS_ERR_NULLPTRβ a null pointer has been found in the list passed in.GENDERS_ERR_MAGICβhandlehas an incorrect magic number. Which means:handledoes not point to a genders handle, orhandlehas been destroyed bygenders_handle_destroy(3). Rude of you, honestly π
π FILES π
/usr/include/genders.h
π¦ SEE ALSO π¦
libgenders(3), genders_handle_create(3), genders_load_data(3), genders_getnumnodes(3), genders_nodelist_create(3), genders_errnum(3), genders_strerror(3)
And that's the whole page, bestie!! This one came straight outta LLNL, dated August 2003 β yes she's an elder icon and yes she still eats πβ¨π
π¦ 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-2002 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