1
2
3
4
5
6
7
8
9gd_alter_affixes(3) GETDATA gd_alter_affixes(3)
10
11
12
14 gd_alter_affixes — modify the field affixes of a fragments in a Dirfile
15
16
18 #include <getdata.h>
19
20 int gd_alter_affixes(DIRFILE *dirfile, int fragment_index, const char
21 *prefix, const char *suffix);
22
23
25 The gd_alter_affixes() function sets the root namespace, field prefix
26 and suffix of fields defined in the format specification fragment given
27 by fragment_index to prefix and suffix in the dirfile(5) database spec‐
28 ified by dirfile.
29
30 The prefix may contain a root namespace for the fragment, separated
31 from the prefix by a dot (.). If it does not contain a namespace, the
32 fragment's root namespace is not changed. To remove a root namespace,
33 explicitly specify the null namespace via a leading dot in prefix.
34
35 The field prefix and suffix are affixed to all field codes found in the
36 specified fragment. If the parent fragment to the modified fragment
37 contains field affixes themselves, they should be included in the af‐
38 fixes passed to gd_alter_affixes(). If prefix or suffix is NULL, the
39 corresponding affix will be unchanged. To remove an affix, set it to
40 the parent fragment's corresponding affix, which may be the empty
41 string ("").
42
43 It is not possible to set affixes on the root format file (i.e.
44 fragment_index may not be zero).
45
46 The dirfile argument must point to a valid DIRFILE object previously
47 created by a call to gd_open(3).
48
49
51 Upon successful completion, gd_alter_affixes() returns zero. On error,
52 it returns a negative-valued error code. Possible error codes are:
53
54 GD_E_ACCMODE
55 The specified dirfile was opened read-only.
56
57 GD_E_ALLOC
58 The library was unable to allocate memory.
59
60 GD_E_BAD_CODE
61 The supplied prefix or suffix contained invalid characters.
62
63 GD_E_BAD_DIRFILE
64 The supplied dirfile was invalid.
65
66 GD_E_BAD_INDEX
67 The supplied index was out of range.
68
69 GD_E_DUPLICATE
70 The supplied affixes would result in one or more field codes
71 duplicating an existing field code.
72
73 GD_E_PROTECTED
74 The metadata of the given fragment's parent fragment was pro‐
75 tected from change.
76
77 The error code is also stored in the DIRFILE object and may be re‐
78 trieved after this function returns by calling gd_error(3). A descrip‐
79 tive error string for the error may be obtained by calling
80 gd_error_string(3).
81
82
84 The function gd_fragment_namespace(3) can also be used to modify the
85 root namespace.
86
87
89 The function gd_alter_affixes() appeared in GetData-0.8.0.
90
91 In GetData-0.10.0, the error return from this function changed from -1
92 to a negative-valued error code.
93
94
96 gd_error(3), gd_error_string(3), gd_fragment_affixes(3),
97 gd_include_affix(3), gd_open(3), dirfile(5), dirfile-format(5)
98
99
100
101Version 0.10.0 27 January 2016 gd_alter_affixes(3)