Scroll to navigation

gd_linterp_tablename(3) GETDATA gd_linterp_tablename(3)

NAME

gd_linterp_tablename — retrieve the pathname of a look-up table in a Dirfile

SYNOPSIS

#include <getdata.h>

char *gd_linterp_tablename(DIRFILE *dirfile, const char *field_code);

DESCRIPTION

The gd_linterp_tablename() function retrieves the pathname of the look-up table (LUT) used by the LINTERP field specified by field_code in the dirfile specified by dirfile. If field_code contains a valid representation suffix, it will be ignored.

Note: this function returns a fully canonicalised, absolute path. The value of the table member in a gd_entry_t object (see gd_entry(3)) is the path which appears in the format specification on disk, which may be a path relative to the fragment directory.

RETURN VALUE

On success, gd_linterp_tablename() returns the full pathname of the LUT associated with the specified field in a newly-allocated buffer. By default, this buffer is allocated with malloc(3), but a different memory manager may be specified by calling gd_alloc_funcs(3) before calling this function. The caller is responsible for deallocating the returned buffer.

On error, this function returns NULL and stores a negative-valued error code in the DIRFILE object which may be retrieved by a subsequent call to gd_error(3). Possible error codes are:

GD_E_ALLOC
The library was unable to allocate memory.
GD_E_BAD_CODE
The field specified by field_code was not found.
GD_E_BAD_DIRFILE
The supplied dirfile was invalid.
GD_E_BAD_FIELD_TYPE
The field specified by field_code was not a LINTERP field.

A descriptive error string for the error may be obtained by calling gd_error_string(3).

HISTORY

The gd_linterp_tablename() function appeared in GetData-0.8.1.

SEE ALSO

gd_alloc_funcs(3), gd_entry(3), gd_error(3), gd_error_string(3), dirfile(5), dirfile-format(5)

25 December 2016 Version 0.10.0