gd_add_alias(3)
π gd_add_alias(3) β GETDATA π
okay bestie, pull up a chair, we're talking about gd_add_alias(3) and its sibling gd_madd_alias(3) β the getdata girls whose whole thing is adding fields to a Dirfile. lowkey iconic. this is section 3 of the manual, the GETDATA girlies' home turf, so let's get into it π
β¨ NAME β¨
gd_add_alias, gd_madd_alias β add a field to a Dirfile. no cap, that's the whole job description. π
πΈ SYNOPSIS πΈ
#include <getdata.h>
int gd_add_alias(DIRFILE *dirfile, const char *alias_name, const char
*target_code, int fragment_index);
int gd_madd_alias(DIRFILE *dirfile, const char *parent, const char
*alias_name, const char *target_code);
like yes, the line breaks are unhinged, that's just how C headers do. copy them exactly, don't @ me π¦
π DESCRIPTION π
so. gd_add_alias() adds the alias named alias_name pointing to target_code, and it drops it into the fragment indexed by fragment_index, inside the dirfile that dirfile points at. that's it, that's the vibe. β¨
then we have gd_madd_alias(), which is giving same energy, different placement β it behaves similarly, EXCEPT it adds the field as a meta-entry under the field indicated by the field code parent. so it's a little nested situation, a field living rent-free inside another field's metadata. main character behaviour honestly. π
π₯ RETURN VALUE π₯
on success? zero. we love a clean zero. π
on error? a negative-valued error code comes back at you, and bestie, here's the full roster of possible ones:
GD_E_ACCMODEβ the specified dirfile was opened read-only. so likeβ¦ you can look but you cannot touch. πGD_E_ALLOCβ the library could not allocate memory. it's not you, it's the heap.GD_E_BAD_CODEβ eitheralias_namewas invalid (containing an invalid character, or lacking the containing fragment's namespace or affixes), OR theparentfield code was not found, or it was already a metafield. messy either way.GD_E_BAD_DIRFILEβ the supplied dirfile was invalid. not a real dirfile, just a vibe. π«GD_E_BAD_INDEXβ thefragment_indexspecified was out of range. she's not here, hun.GD_E_DUPLICATEβ thealias_nameparameter duplicated that of an already existing entry. name already taken, try again πGD_E_PROTECTEDβ the metadata of the fragment was protected from change. or, the creation of aRAWfield was attempted and the data of the fragment was protected. hands off, it's protected!! π«
and yes, the error code is ALSO stored in theDIRFILEobject, so after this function returns you can go retrieve it withgd_error(3). want a descriptive error string instead? that'sgd_error_string(3). π«Ά
β HISTORY β
gd_add_alias()andgd_madd_alias()appeared in GetData-0.8.0. little babies, all grown up now π₯Ή- in GetData-0.10.0, the error return from these functions changed from
-1to a negative-valued error code. glow-up fr fr β¨
π SEE ALSO π
gd_add(3), gd_alias_target(3), gd_entry(3), gd_madd(3), gd_metaflush(3), gd_open(3), dirfile-format(5) β go read your sisters, bestie, they ate π
and that's the page!! this is Version 0.10.0, dated 25 December 2016 β a lil christmas gift from the GETDATA girlies to you πβ¨ slay, periodt, go add some aliases responsibly ππ π¦
π¦ 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) 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