gd_fragmentname(3)

πŸ’– gd_fragmentname β€” bestie edition ✨

ok so this is the GETDATA manual page for gd_fragmentname(3) and she is iconic β€” she gets you the name of a Dirfile format specification fragment and honestly? she serves. let's go πŸ¦‹


🌸 NAME 🌸

gd_fragmentname β€” retrieve a Dirfile format specification fragment name πŸŽ€


✨ SYNOPSIS ✨

#include <getdata.h>

const char* gd_fragmentname(const DIRFILE *dirfile, int index);

πŸ’… DESCRIPTION πŸ’…

okay so the gd_fragmentname() function queries a dirfile(5) database that you pass in as dirfile, and it hands you back the filename of the format specification fragment indexed by the non-negative index. no cap. πŸ’–

the dirfile argument has to point to a valid DIRFILE object β€” and it has to be one you already created by calling gd_open(3). no random objects, bestie, she's picky 🫢

here's the tea about indexing: the fragment with index equal to zero is always the primary fragment for the database β€” that's the file called format in the root dirfile directory. iconic, always first, main character energy πŸ‘‘

and the largest valid value of index is one less than the total number of fragments. how do you find the total? call gd_nfragments(3), obviously πŸ’…


πŸ”₯ RETURN VALUE πŸ”₯

when everything goes right? she returns a pointer to a read-only character string containing the file name of the specified fragment. slay. ✨

but when things go wrong 😭 she returns NULL and stashes a negative-valued error code in the DIRFILE object, which you can grab later with gd_error(3). the possible error codes are:

  • GD_E_BAD_DIRFILE β€” the dirfile you gave her was invalid. rude, but fair πŸ’€
  • GD_E_BAD_INDEX β€” the index you gave her was out of range. bestie. girl. check your bounds πŸ™ˆ

if you want a descriptive error string for whatever went wrong, call gd_error_string(3) and she'll tell you all about it 🌸


🌈 HISTORY 🌈

  • the get_fragmentname() function showed up in GetData-0.4.0 β€” vintage, lowkey a classic πŸŽ€
  • then in GetData-0.7.0 this function got renamed to gd_fragmentname(). glow-up fr fr ⭐

🫢 SEE ALSO 🫢

dirfile(5), gd_error(3), gd_error_string(3), gd_include(3), gd_nfragments(3), gd_open(3), gd_parent_fragment(3)

go read them, iykyk πŸ‘‘


and that's the whole page, no notes πŸ’œ this was Version 0.10.0, dated 25 December 2016, and it's gd_fragmentname(3) forever and always πŸ§šπŸ’–