1
2
3
4
5
6
7
8
9gd_add_alias(3) GETDATA gd_add_alias(3)
10
11
12
14 gd_add_alias, gd_madd_alias — add a field to a Dirfile
15
16
18 #include <getdata.h>
19
20 int gd_add_alias(DIRFILE *dirfile, const char *alias_name, const char
21 *target_code, int fragment_index);
22
23 int gd_madd_alias(DIRFILE *dirfile, const char *parent, const char
24 *alias_name, const char *target_code);
25
26
28 The gd_add_alias() function adds the alias named alias_name pointing to
29 target_code to the fragment indexed by fragment_index in the dirfile
30 specified by dirfile. The gd_madd_alias() function behaves similarly,
31 but adds the field as a meta-entry under the field indicated by the
32 field code parent.
33
34
36 On success, gd_add_alias() and gd_madd_alias() return zero. On error,
37 a negative-valued error code is returned. Possible error codes are:
38
39 GD_E_ACCMODE
40 The specified dirfile was opened read-only.
41
42 GD_E_ALLOC
43 The library was unable to allocate memory.
44
45 GD_E_BAD_CODE
46 Either the alias_name was invalid: containing an invalid char‐
47 acter or lacking the containing fragment's namespace or affix‐
48 es, or else the parent field code was not found, or was already
49 a metafield.
50
51 GD_E_BAD_DIRFILE
52 The supplied dirfile was invalid.
53
54 GD_E_BAD_INDEX
55 The fragment_index specified was out of range.
56
57 GD_E_DUPLICATE
58 The alias_name parameter duplicated that of an already existing
59 entry.
60
61 GD_E_PROTECTED
62 The metadata of the fragment was protected from change. Or,
63 the creation of a RAW field was attempted and the data of the
64 fragment was protected.
65
66 The error code is also stored in the DIRFILE object and may be re‐
67 trieved after this function returns by calling gd_error(3). A descrip‐
68 tive error string for the error may be obtained by calling
69 gd_error_string(3).
70
71
73 The functions gd_add_alias() and gd_madd_alias() appeared in GetDa‐
74 ta-0.8.0.
75
76 In GetData-0.10.0, the error return from these functions changed from
77 -1 to a negative-valued error code.
78
79
81 gd_add(3), gd_alias_target(3), gd_entry(3), gd_madd(3),
82 gd_metaflush(3), gd_open(3), dirfile-format(5)
83
84
85
86Version 0.10.0 25 December 2016 gd_add_alias(3)