Provided by: libgetdata-doc_0.10.0-3build2_all bug

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 gd_fragment_affixes() 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  returned  prefix does NOT contain the root namespace of the
       fragment.  To retreive that, use gd_fragment_namespace(3).

       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_affixes() 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  malloc(3)  is used to allocate these buffers, but a different
       allocator may be specified by calling gd_alloc_funcs(3) 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:

       GD_E_ALLOC
               A memory allocation error occurred.

       GD_E_BAD_DIRFILE
               The supplied dirfile was invalid.

       GD_E_BAD_INDEX
               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 gd_error(3).  A descriptive error string for the error may be
       obtained by calling gd_error_string(3).

HISTORY

       The gd_fragment_affixes() 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

       gd_alloc_funcs(3),  gd_alter_affixes(3),  gd_fragment_namespace(3), gd_include_affixes(3),
       gd_open(3), dirfile(5), dirfile-format(5)