gd_add_spec(3)

NAME
gd_add_spec, gd_madd_spec — add a field to a Dirfile

SYNOPSIS
#include <getdata.h>

int gd_add_spec(DIRFILE *dirfile, const char *line, int fragment_index);

int gd_madd_spec(DIRFILE *dirfile, const char *line, const char *parent);

DESCRIPTION
The function adds the field described by the field specification line in to the dirfile specified by The function behaves similarly, but adds the field as a metafield under the field indicated by the field Field specification lines are described in detail in dirfile-format(5). Since Standards Version 7 (see dirfile(5)) permits specifying metafield without the use of the /META directive, may also be used to add metafields, by specifying the metafield's full field code. See dirfile-format(5) for full details.

When using should only contain a field specification, and not a /META directive.

Passing these functions a directive line instead of a field specification line will result in a syntax error. These functions never call the registered parser callback function, even if contains a syntax error.

RETURN VALUE
On success, and return zero. On error, a negative-valued error code is returned. Possible error codes are: The specified dirfile was opened read-only. The library was unable to allocate memory. The field code was not found, or was already a metafield. The supplied dirfile was invalid. The argument was out of range. A syntax error was encountered in An I/O error occurred while creating an empty binary file to be associated with a newly added RAW field. The supplied was longer than the parser was able to deal with. Line lengths are limited by the storage size of size_t. The metadata of the fragment was protected from change. Or, the creation of a RAW field was attempted and the data of the fragment was protected. The encoding scheme of the indicated format specification fragment is not known to the library. As a result, the library was unable to create an empty binary file to be associated with a newly added RAW field. The encoding scheme of the indicated format specification fragment does not support creating an empty binary file to be associated with a newly added RAW field.

The error code is also stored in the DIRFILE object and may be retrieved after this function returns by calling A descriptive error string for the error may be obtained by calling

HISTORY
The functions and appeared in GetData-0.4.0.

In GetData-0.7.0, these functions were renamed to and

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

SEE ALSO
all the gd_add_<entry-type> functions (e.g., all the gd_madd_<entry-type> functions (e.g., dirfile-format(5)