gd_alter_affixes—modify the field affixes of a fragments in a Dirfile
#include <getdata.h>
int gd_alter_affixes(DIRFILE *dirfile, int fragment_index, const char *prefix, const char *suffix);
The gd_alter_affixes() function sets the root namespace, field prefix and suffix of fields defined in the format specification fragment given by fragment_index to prefix and suffix in the dirfile(5) database specified by dirfile.
The prefix may contain a root namespace for the fragment, separated from the prefix by a dot (.). If it does not contain a namespace, the fragment's root namespace is not changed. To remove a root namespace, explicitly specify the null namespace via a leading dot in prefix.
The field prefix and suffix are affixed to all field codes found in the specified fragment. If the parent fragment to the modified fragment contains field affixes themselves, they should be included in the affixes passed to gd_alter_affixes(). If prefix or suffix is NULL, the corresponding affix will be unchanged. To remove an affix, set it to the parent fragment's corresponding affix, which may be the empty string ("").
It is not possible to set affixes on the root format file (i.e. fragment_index may not be zero).
The dirfile argument must point to a valid DIRFILE object previously created by a call to gd_open(3).
Upon successful completion, gd_alter_affixes() returns zero. On error, it returns a negative-valued error code. Possible error codes are:
The error code is also stored in the DIRFILE object and may be retrieved after this function returns by calling gd_error(3). A descriptive error string for the error may be obtained by calling gd_error_string(3).
The function gd_fragment_namespace(3) can also be used to modify the root namespace.
The function gd_alter_affixes() appeared in GetData-0.8.0.
In GetData-0.10.0, the error return from this function changed from −1 to a negative-valued error code.
gd_error(3), gd_error_string(3), gd_fragment_affixes(3), gd_include_affix(3), gd_open(3), dirfile(5), dirfile-format(5)