gd_alias_target(3)

πŸ’– gd_alias_target(3) β€” GETDATA πŸ’–

okay bestie, welcome to the manual page for gd_alias_target, living in the GETDATA section 3 of your friendly neighbourhood man pages. it's giving "who is this alias actually pointing at" energy and honestly? we're obsessed. πŸ¦‹


✨ NAME ✨

gd_alias_target β€” determine the target of an alias defined in a Dirfile database 🌸


πŸŽ€ SYNOPSIS πŸŽ€

#include <getdata.h>

const char *gd_alias_target(DIRFILE *dirfile, const char *alias_name);

πŸ’… DESCRIPTION πŸ’…

so. the gd_alias_target() function queries a dirfile(5) database β€” the one you specify with dirfile β€” and figures out the target field code of the alias you named in alias_name. that's it. that's the whole vibe. ✨

the dirfile argument must point to a valid DIRFILE object that you already made with a call to gd_open(3). no shortcuts, no pretending, no "i'll make it later". valid object or bust. πŸ’€

note bestie, listen up: the target may itself be an alias, and that alias will have its own target. aliases in aliases, it's giving inception fr fr. πŸŒ€ if you want the canonical name of the field that's ultimately referenced by alias_name, pass it to gd_entry(3) and go inspect the field member of the gd_entry_t structure it hands back. iykyk. πŸ‘‘

πŸ”₯ RETURN VALUE πŸ”₯

when everything slays, gd_alias_target() returns a pointer to a read-only character string containing the name of the target of the alias you asked about. you don't own it, don't touch it, just read it and move on. 🫢

on error, gd_alias_target() returns NULL and sets the dirfile error to a non-zero error value. possible error values are:

  • GD_E_BAD_CODE β€” the name alias_name was not found in the dirfile. πŸ’€
  • GD_E_BAD_DIRFILE β€” the supplied dirfile was invalid. πŸ™ˆ
  • GD_E_BAD_FIELD_TYPE β€” the entry specified by alias_name was not an alias. girl, that's not an alias, that's something else entirely. 😭

you can grab the dirfile error by calling gd_error(3). and if you want a whole descriptive error string for the last error encountered, hit up gd_error_string(3) β€” it'll tell you what went wrong in actual words. πŸ“


🌈 HISTORY 🌈

the function gd_alias_target() first appeared in GetData-0.8.0. a true icon, a legend, the moment. πŸ‘‘


⭐ SEE ALSO ⭐


and that's the page bestie!! this manual is Version 0.10.0, dated 25 December 2016 β€” a little holiday gift from the GetData girlies. go forth and resolve your aliases, you absolute main character. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’