gd_add_alias(3)

NAME
gd_add_alias, gd_madd_alias — add a field to a Dirfile

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);

DESCRIPTION
The function adds the alias named pointing to to the fragment indexed by in the dirfile specified by The function behaves similarly, but adds the field as a meta-entry under the field indicated by the field code

RETURN VALUE
On success, and return zero. On error, a negative-valued error code is returned. Possible error codes are: The specified dirfile was opened read-only. The library was unable to allocate memory. Either the was invalid: containing an invalid character or lacking the containing fragment's namespace or affixes, or else the field code was not found, or was already a metafield. The supplied dirfile was invalid. The specified was out of range. The parameter duplicated that of an already existing entry. The metadata of the fragment was protected from change. Or, the creation of a RAW field was attempted and the data of the fragment was protected.

The error code is also stored in the DIRFILE object and may be retrieved after this function returns by calling A descriptive error string for the error may be obtained by calling

HISTORY
The functions and appeared in GetData-0.8.0. In GetData-0.10.0, the error return from these functions changed from -1 to a negative-valued error code.

SEE ALSO
dirfile-format(5)