1
2
3
4
5
6
7
8
9gd_fragment_affixes(3) GETDATA gd_fragment_affixes(3)
10
11
12
14 gd_fragment_affixes — report the field affixes of a fragment of a
15 Dirfile database
16
17
19 #include <getdata.h>
20
21 int gd_fragment_affixes(DIRFILE *dirfile, int fragment_index, char
22 **prefix, char **suffix);
23
24
26 The gd_fragment_affixes() function queries a dirfile(5) database speci‐
27 fied by dirfile and returns the field affixes for the fragment indexed
28 by fragment_index. The field prefix and suffix are appended to all
29 field codes found in the specified fragment.
30
31 The prefix and suffix parameters point to memory locations in which
32 store the addresses of the returned strings. The returned prefix does
33 NOT contain the root namespace of the fragment. To retreive that, use
34 gd_fragment_namespace(3).
35
36 The dirfile argument must point to a valid DIRFILE object previously
37 created by a call to gd_open(3).
38
39
41 Upon successful completion, gd_fragment_affixes() returns zero. If
42 non-empty, the prefix and suffix are reported in heap-allocated buffers
43 whose addresses are returned in *prefix and *suffix. By default
44 malloc(3) is used to allocate these buffers, but a different allocator
45 may be specified by calling gd_alloc_funcs(3) before calling this func‐
46 tion. The caller is responsible for deallocating the buffers. If the
47 fragment prefix or suffix is the empty string, NULL is returned in the
48 corresponding pointer.
49
50 On error, a negative-valued error code is returned. In this case, the
51 values of *prefix and *suffix are unspecified, but will NOT be pointers
52 to valid allocated memory. Possible returned error codes are:
53
54 GD_E_ALLOC
55 A memory allocation error occurred.
56
57 GD_E_BAD_DIRFILE
58 The supplied dirfile was invalid.
59
60 GD_E_BAD_INDEX
61 The supplied index was out of range.
62
63 The error code is also stored in the DIRFILE object and may be re‐
64 trieved after this function returns by calling gd_error(3). A descrip‐
65 tive error string for the error may be obtained by calling
66 gd_error_string(3).
67
68
70 The gd_fragment_affixes() function appeared in GetData-0.8.0.
71
72 In GetData-0.10.0, the error return from this function changed from -1
73 to a negative-valued error code.
74
75
77 gd_alloc_funcs(3), gd_alter_affixes(3), gd_fragment_namespace(3),
78 gd_include_affixes(3), gd_open(3), dirfile(5), dirfile-format(5)
79
80
81
82Version 0.10.0 25 December 2016 gd_fragment_affixes(3)