gd_fragment_index(3)
π gd_fragment_index β bestie edition π
okay so this is a page from the GETDATA manual (section 3, the library-functions girlies), and it's all about gd_fragment_index. let's get into it π«Ά
β¨ NAME β¨
gd_fragment_index β go find the fragment that's holding your Dirfile field, queen π
πΈ SYNOPSIS πΈ
#include <getdata.h>
int gd_fragment_index(const DIRFILE *dirfile, const char *entry_name);
π DESCRIPTION π
so basically, gd_fragment_index() slides into a dirfile(5) database β the one you point at with dirfile β and hands you back the index number of the fragment that defines the field (or alias) named entry_name. like, which fragment is this entry living in? that one. there you go. β¨
π¨ okay listen up because this is the plot twist: this is one of the few GetData functions that does not resolve aliases. so if you pass in the name of an alias as entry_name, you get the index of the fragment containing the alias itself, not the index of whatever it's pointing at. no chasing the target, no detective work. just the alias, in its own home. periodt π
π₯ RETURN VALUE π₯
when it works? gd_fragment_index() returns the fragment index you asked for, and that number is never negative. icon behavior.
when it's not working? it returns a negative-valued error code. the possible ones are:
GD_E_BAD_CODEβ the entry you named in entry_name was not found in the database π she's not here.GD_E_BAD_DIRFILEβ the dirfile you handed over was invalid π
also, that error code gets tucked away in the DIRFILE object too, so you can grab it after the function returns by calling gd_error(3). and if you want a whole descriptive error string β like, actual words about what went wrong β hit up gd_error_string(3). π
π¦ HISTORY π¦
- the
get_fragment_index()function first showed up in GetData-0.5.0. a legend was born. - in GetData-0.7.0, she got a glow-up and was renamed to
gd_fragment_index(). - in GetData-0.10.0, the error return changed from
-1to a negative-valued error code. glow-up number two β¨
π SEE ALSO π
gd_open(3)gd_entry(3)gd_error(3)gd_error_string(3)gd_fragmentname(3)gd_parent_fragment(3)dirfile(5)
and that's the whole page bestie, no cap π§
this was Version 0.10.0, dated 25 December 2016 β so yeah, a lil vintage, but she still ate. mwah ππ
π¦ where this page comes from
- debian bookworm: libgetdata-doc 0.11.0-6
- debian trixie: libgetdata-doc 0.11.0-15
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- nixos 26.05: getdata 0.11.0
- nixpkgs unstable: getdata 0.11.0
- ubuntu jammy: libgetdata-doc 0.11.0-3ubuntu1
- ubuntu noble: libgetdata-doc 0.11.0-13
- ubuntu questing: libgetdata-doc 0.11.0-15
- ubuntu resolute: libgetdata-doc 0.11.0-17build1
- ubuntu stonking: libgetdata-doc 0.11.0-17build2
- Copyright (C) 2016 D. V. Wiebe
- Copyright (C) 2008, 2009, 2010, 2011, 2012, 2016 D. V. Wiebe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms