1
2
3
4
5
6
7
8
9gd_reference(3) GETDATA gd_reference(3)
10
11
12
14 gd_reference — retrieve or set the reference field for a Dirfile
15
16
18 #include <getdata.h>
19
20 const char *gd_reference(DIRFILE *dirfile, const char *field_code);
21
22
24 The gd_reference() function sets or retrieves the reference field (see
25 dirfile(5)) associated with the dirfile specified by dirfile. If the
26 field_code argument is non-NULL, the reference field for the dirfile
27 will be set to the field specified. If field_code is NULL, the refer‐
28 ence field is not modified. The field code should refer to a RAW
29 field, and may not contain a representation suffix.
30
31
33 On success, gd_reference() returns the field code of the dirfile's ref‐
34 erence field, which will be field_code, if field_code is non-NULL. If
35 no RAW fields are defined in the dirfile, this function will return
36 NULL, without raising an error. On error, NULL is returned and the
37 dirfile error is set to a non-zero error value. Possible error values
38 are:
39
40 GD_E_ACCMODE
41 The specified dirfile was opened read-only.
42
43 GD_E_ALLOC
44 The library was unable to allocate memory.
45
46 GD_E_BAD_CODE
47 The field specified by field_code was not found.
48
49 GD_E_BAD_DIRFILE
50 The supplied dirfile was invalid.
51
52 GD_E_BAD_FIELD_TYPE
53 The field specified by field_code was not a RAW field.
54
55 GD_E_PROTECTED
56 The metadata of the primary format specification fragment (the
57 file named format in the root dirfile directory) was protected
58 from change.
59
60 The dirfile error may be retrieved by calling gd_error(3). A descrip‐
61 tive error string for the last error encountered can be obtained from a
62 call to gd_error_string(3).
63
64
66 The get_reference() function appeared in GetData-0.4.2. It took only
67 one parameter (the DIRFILE), and returned the current reference field.
68
69 The dirfile_reference() function appeared in GetData-0.5.0.
70
71 In GetData-0.7.0, the dirfile_reference() function was renamed to
72 gd_reference() and the get_reference() function was removed.
73
74
76 gd_error(3), gd_error_string(3), gd_metaflush(3), gd_open(3),
77 dirfile(5), dirfile-format(5)
78
79
80
81Version 0.10.0 25 December 2016 gd_reference(3)