gd_alter_affixes(3)

NAME
gd_alter_affixes — modify the field affixes of a fragments in a Dirfile

SYNOPSIS
#include <getdata.h>

int gd_alter_affixes(DIRFILE *dirfile, int fragment_index, const char *prefix, const char *suffix);

DESCRIPTION
The function sets the root namespace, field prefix and suffix of fields defined in the format specification fragment given by to and in the dirfile(5) database specified by

The 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

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 If or 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. may not be zero).

The argument must point to a valid DIRFILE object previously created by a call to

RETURN VALUE
Upon successful completion, returns zero. On error, it returns a negative-valued error code. Possible error codes are: The specified dirfile was opened read-only. The library was unable to allocate memory. The supplied or contained invalid characters. The supplied dirfile was invalid. The supplied index was out of range. The supplied affixes would result in one or more field codes duplicating an existing field code. The metadata of the given fragment's parent fragment was protected from change.

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

NOTES
The function can also be used to modify the root namespace.

HISTORY
The function 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.

SEE ALSO
dirfile(5), dirfile-format(5)