1
2
3
4
5
6
7
8
9gd_fragment_namespace(3) GETDATA gd_fragment_namespace(3)
10
11
12
14 gd_fragment_namespace — report or change the root namespace of a frag‐
15 ment of a dirfile database
16
17
19 #include <getdata.h>
20
21 const char *gd_fragment_namespace(DIRFILE *dirfile, int fragment_index,
22 char *new_namespace);
23
24
26 The gd_fragment_namespace() function can be used to update and/or query
27 the root namespace of a fragment in the dirfile(5) database specified
28 by dirfile.
29
30 If new_namespace is NULL, then the current root namespace of the frag‐
31 ment indexed by fragment_index is returned. If new_namespace is non-
32 NULL, then the root namespace is first changed to the string provided
33 before being reported. The new namespace may optionally contain a sin‐
34 gle, trailing dot (.). To remove an existing root namespace, pass a
35 pointer to the empty string ("") as new_namespace.
36
37 The root namespace of the root format file (the one indexed by
38 fragment_index=0) may not be changed. It is always the empty string.
39
40 The dirfile argument must point to a valid DIRFILE object previously
41 created by a call to gd_open(3).
42
43
45 Upon successful completion, gd_fragment_namespace() returns a non-NULL
46 pointer to a read-only string containing the current root namespace of
47 the fragment specified. This will be a copy of the string
48 new_namespace, if that parameter was non-NULL. If the fragment's root
49 namespace is empty, a pointer to the empty string ("") will be re‐
50 turned.
51
52 On error, this function returns NULL and sets the dirfile error to a
53 non-zero error value. Possible dirfile error values are:
54
55 GD_E_ACCMODE
56 The dirfile was opened read-only.
57
58 GD_E_ALLOC
59 A memory allocation error occurred.
60
61 GD_E_BAD_CODE
62 The supplied new_fragment was not a valid namespace.
63
64 GD_E_BAD_DIRFILE
65 The supplied dirfile was invalid.
66
67 GD_E_BAD_INDEX
68 The supplied index was out of range. This error will also be
69 returned if an attempt is made to change the root namespace of
70 the root format file (fragment_index zero).
71
72 GD_E_DUPLICATE
73 Attempting to change the root namespace resulted in a duplicat‐
74 ed field definition.
75
76 GD_E_PROTECTED
77 The protection level of the specified fragment prohibits meta‐
78 data changes.
79
80 The dirfile error may be retrieved by calling gd_error(3). A descrip‐
81 tive error string for the last error encountered can be obtained from a
82 call to gd_error_string(3).
83
84
86 The gd_fragment_namespace() function appeared in GetData-0.10.0.
87
88
90 gd_alter_affixes(3), gd_include_ns(3), gd_open(3), dirfile(5), dirfile-
91 format(5)
92
93
94
95Version 0.10.0 25 December 2016 gd_fragment_namespace(3)