dirfile_add_spec (3) Linux Manual Page
dirfile_add_spec, dirfile_madd_spec — add a field to a dirfile
Synopsis
#include <getdata.h>- int dirfile_add_spec(DIRFILE *dirfile, const char *line, int fragment_index);
- int dirfile_madd_spec(DIRFILE *dirfile, const char *line, const char *parent);
Description
When using dirfile_madd_spec(), line 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 line contains a syntax error.
Return Value
On success, dirfile_add_spec() and dirfile_madd_spec() return zero. On error, -1 is returned and the dirfile error is set to a non-zero error value. Possible error values are:- GD_E_ACCMODE
- The specified dirfile was opened read-only.
- GD_E_ALLOC
- The library was unable to allocate memory.
- GD_E_BAD_CODE
- The parent field code was not found, or was already a metafield.
- GD_E_BAD_DIRFILE
- The supplied dirfile was invalid.
- GD_E_BAD_INDEX
- The fragment_index argument was out of range.
- GD_E_FORMAT
- A syntax error was encountered in line.
- GD_E_PROTECTED
- 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.
- GD_E_RAW_IO
- An I/O error occurred while creating an empty binary file to be associated with a newly added RAW field.
- GD_E_UNKNOWN_ENCODING
- The encoding scheme of the specified format file 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.
- GD_E_UNSUPPORTED
- The encoding scheme of the specified format file fragment does not support creating an empty binary file to be associated with a newly added RAW field. 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).
