1dirfile_reference(3) GETDATA dirfile_reference(3)
2
3
4
6 dirfile_reference, get_reference — retrieve or set the reference field
7 for a dirfile
8
10 #include <getdata.h>
11
12 const char *dirfile_reference(DIRFILE *dirfile, const char
13 *field_code);
14
15 const char *get_reference(DIRFILE *dirfile);
16
18 The dirfile_reference() function sets or retrieves the reference field
19 (see dirfile(5)) associated with the dirfile specified by dirfile. If
20 the field_code argument is non-NULL, the reference field for the
21 dirfile will be set to the field specified. If field_code is NULL, the
22 reference field is not modified. The field code should refer to a RAW
23 field, and may not contain a representation suffix.
24
25 get_reference() is equivalent to calling dirfile_reference() with
26 field_code set to NULL.
27
28
30 On success, dirfile_reference() and get_reference() return the field
31 code of the dirfile's reference field, which will be field_code, if
32 field_code is non-NULL. If no RAW fields are defined in the dirfile,
33 these functions will return NULL, without raising an error. On error,
34 NULL is returned and the dirfile error is set to a non-zero error val‐
35 ue. Possible error values are:
36
37 GD_E_ACCMODE
38 The specified dirfile was opened read-only.
39
40 GD_E_ALLOC
41 The library was unable to allocate memory.
42
43 GD_E_BAD_CODE
44 The field specified by field_code was not found.
45
46 GD_E_BAD_DIRFILE
47 The supplied dirfile was invalid.
48
49 GD_E_BAD_FIELD_TYPE
50 The field specified by field_code was not a RAW field.
51
52 GD_E_PROTECTED
53 The metadata of the primary format file fragment (the file
54 named format in the root dirfile directory) was protected from
55 change.
56
57 The dirfile error may be retrieved by calling get_error(3). A descrip‐
58 tive error string for the last error encountered can be obtained from a
59 call to get_error_string(3).
60
62 dirfile_metaflush(3), dirfile_open(3), get_error(3), get_er‐
63 ror_string(3), dirfile(5), dirfile-format(5)
64
65
66
67Version 0.6.0 19 October 2009 dirfile_reference(3)