get_fragmentname (3) - Linux Manuals

get_fragmentname: retrieve a dirfile format file fragment name

NAME

get_fragmentname --- retrieve a dirfile format file fragment name

SYNOPSIS

#include <getdata.h>
const char* get_fragmentname(const DIRFILE *dirfile, int index);

DESCRIPTION

The get_fragmentname() function queries a dirfile(5) database specified by dirfile and returns the filename of the format file fragment indexed by the non-negative index.

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

The format file fragment with index equal to zero is always the primary format file for the database (the file called format in the root dirfile directory). The largest valid value of index is one less than the total number of format file fragments, which may be obtained from a call to get_nfragments(3).

RETURN VALUE

Upon successful completion, get_fragmentname() returns a pointer to a read-only character string containing the file name of the specified format file fragment. On error, get_fragmentname() returns NULL and sets the dirfile error a non-zero error value. Possible 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 get_error(3). A descriptive error string for the last error encountered can be obtained from a call to get_error_string(3).