gd_fragment_affixes(3)

NAME
gd_fragment_affixes — report the field affixes of a fragment of a Dirfile database

SYNOPSIS
#include <getdata.h>

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

DESCRIPTION
The function queries a dirfile(5) database specified by and returns the field affixes for the fragment indexed by The field prefix and suffix are appended to all field codes found in the specified fragment. The and parameters point to memory locations in which store the addresses of the returned strings. The returned does NOT contain the root namespace of the fragment. To retreive that, use The argument must point to a valid DIRFILE object previously created by a call to

RETURN VALUE
Upon successful completion, returns zero. If non-empty, the prefix and suffix are reported in heap-allocated buffers whose addresses are returned in *prefix and *suffix. By default is used to allocate these buffers, but a different allocator may be specified by calling before calling this function. The caller is responsible for deallocating the buffers. If the fragment prefix or suffix is the empty string, NULL is returned in the corresponding pointer. On error, a negative-valued error code is returned. In this case, the values of *prefix and *suffix are unspecified, but will NOT be pointers to valid allocated memory. Possible returned error codes are: A memory allocation error occurred. The supplied dirfile was invalid. The supplied index was out of range.

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