gd_fragment_index(3)

gd_fragment_index3

Retrieve the fragment containing a dirfile field

Usage

#include <getdata.h>

int gd_fragment_index(const DIRFILE *dirfile, const char *entry_name);

Overview

The gd_fragment_index() function queries a dirfile(5) database specified by dirfile and returns the index number of the fragment defining the field or alias named entry_name.

This is one of the few GetData functions which does not resolve aliases: supplying the name of an alias as entry_name will return the index of the fragment containing the alias itself and not that of its target.

Return value

Upon successful completion, gd_fragment_index() returns the requested fragment index, which is never negative. On error, gd_fragment_index() returns a negative-valued error code. Possible error codes are:
.TP 8 GD_E_BAD_CODE The entry specified by entry_name was not found in the database.
.TP 8 GD_E_BAD_DIRFILE The supplied dirfile was invalid.

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

Releases

7 releases since Debian 7 (Wheezy); the text changed 2 times.

  1. 7–8
  2. 9
  3. 10–13

History

The get_fragment_index() function appeared in GetData-0.5.0.

In GetData-0.7.0, this function was renamed to gd_fragment_index().

In GetData-0.10.0, the error return from this function changed from -1 to a negative-valued error code.

From libgetdata-doc 0.11.0-15 in Debian 13 (Trixie). Parsed by carta from the page's man source.