1get_field_list_by_type(3) GETDATA get_field_list_by_type(3)
2
3
4
6 get_field_list_by_type — retrieve a list of fields in a dirfile
7
9 #include <getdata.h>
10
11 const char **get_field_list_by_type(DIRFILE *dirfile, gd_entype_t
12 type);
13
15 The get_field_list_by_type() function queries a dirfile(5) database
16 specified by dirfile and returns a read-only list of names of the all
17 fields of the indicated type which are defined in the database. No‐
18 tably, this list does not include /META subfields.
19
20 The dirfile argument must point to a valid DIRFILE object previously
21 created by a call to dirfile_open(3). The type argument should be one
22 of the following symbols indicating the desired field type:
23
24 GD_BIT_ENTRY, GD_CONST_ENTRY, GD_INDEX_ENTRY,
25 GD_LINCOM_ENTRY, GD_LINTERP_ENTRY, GD_MULTIPLY_ENTRY,
26 GD_PHASE_ENTRY, GD_POLYNOM_ENTRY, GD_RAW_ENTRY, GD_SBIT_ENTRY,
27 GD_STRING_ENTRY.
28
29 The array returned will be de-allocated by a call to dirfile_close(3)
30 and should not be de-allocated by the caller. The list returned should
31 not be assumed to be in any particular order. The array is terminated
32 by a NULL pointer. The number of fields in the array can be obtained
33 from a call to get_nfields_by_type(3).
34
35 The caller may not modify any strings in the array, or the array it‐
36 self. Doing so may cause database corruption. The pointer returned is
37 guaranteed to be valid until get_field_list_by_type() is called again
38 on the same DIRFILE object with the same type argument, or until the
39 array is deallocated by a call to dirfile_close(3).
40
41 For CONST and STRING field types, corresponding lists of values for may
42 be obtained by calling get_constants(3) or get_strings(3).
43
44
46 Upon successful completion, get_field_list_by_type() returns a pointer
47 to an array of strings containing the names of all the fields defined
48 in the dirfile database of the specific type. On error it returns NULL
49 and sets the dirfile error to a non-zero error value. Possible error
50 values are:
51
52 GD_E_ALLOC
53 The library was unable to allocate memory.
54
55 GD_E_BAD_DIRFILE
56 The supplied dirfile was invalid.
57
58 The dirfile error may be retrieved by calling get_error(3). A descrip‐
59 tive error string for the last error encountered can be obtained from a
60 call to get_error_string(3).
61
63 dirfile(5), dirfile_open(3), get_constants(3), get_error(3), get_er‐
64 ror_string(3), get_field_list(3), get_mfield_list_by_type(3),
65 get_nfields_by_type(3), get_strings(3)
66
67
68
69Version 0.6.0 16 October 2009 get_field_list_by_type(3)