gd_fragment_affix(3)

NAME
gd_fragment_affix — report the field affixes of a fragment of a dirfile database

SYNOPSIS
#include <getdata.h>

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

DESCRIPTION
The gd_fragment_affix() function queries a dirfile(5) database specified by dirfile and returns the field affixes for the fragment indexed by fragment_index. The field prefix and suffix are appended to all field codes found in the specified fragment.

The prefix and suffix parameters point to memory locations in which store the addresses of the returned strings.

The dirfile argument must point to a valid DIRFILE object previously created by a call to gd_open(3).

RETURN VALUE
Upon successful completion, gd_fragment_affix() returns zero. If non-empty, the prefix and suffix are reported in malloc(3)'d buffers whose addresses are returned in *prefix and *suffix. They should be deallocated by the caller when no longer needed by calling free(3). If the fragment prefix or suffix is the empty string, NULL is returned in the corresponding pointer.

On error, -1 is returned and sets the dirfile error to a non-zero error value. In this case, the values of *prefix and *suffix are unspecified, but will NOT be pointers to valid allocated memory. Possible dirfile error values are:

GD_E_BAD_DIRFILE
    The supplied dirfile was invalid.

GD_E_BAD_INDEX
    The supplied index was out of range.

The dirfile error may be retrieved by calling gd_error(3). A descriptive error string for the last error encountered can be obtained from a call to gd_error_string(3).

SEE ALSO
gd_alter_frameoffset(3), gd_include_affixes(3), gd_open(3), dirfile(5), dirfile-format(5)