1get_strings(3) GETDATA get_strings(3)
2
3
4
6 get_strings — retrieve a list of string values from a dirfile
7
9 #include <getdata.h>
10
11 const char **get_strings(DIRFILE *dirfile);
12
14 The get_strings() function queries a dirfile(5) database specified by
15 dirfile and returns a read-only list of values of the all STRING type
16 fields defined in the database. Notably, this list does not include
17 /META subfields.
18
19 The dirfile argument must point to a valid DIRFILE object previously
20 created by a call to dirfile_open(3).
21
22 The array returned will be de-allocated by a call to dirfile_close(3)
23 and should not be de-allocated by the caller. The list returned should
24 not be assumed to be in any particular order, although it is guaranteed
25 to be in the same order as the list of STRING fields returned by
26 get_field_list_by_type(3). The array is terminated by a NULL pointer.
27 The number of strings in the array can be obtained from a call to
28 get_nfields_by_type(3).
29
30 The caller may not modify any strings in the array, or the array it‐
31 self. Doing so may cause database corruption. The pointer returned is
32 guaranteed to be valid until get_strings() is called again with the
33 same arguments, or until the array is deallocated by a call to
34 dirfile_close(3).
35
36 A corresponding list of names for these fields may be obtained by call‐
37 ing get_field_list_by_type(3).
38
39
41 Upon successful completion, get_strings() returns a pointer to an array
42 of strings containing the values of all the STRING fields defined in
43 the dirfile database. If no strings are defined in the database, NULL
44 is returned. On error it returns NULL and sets the dirfile error to a
45 non-zero error value. Possible error values are:
46
47 GD_E_ALLOC
48 The library was unable to allocate memory.
49
50 GD_E_BAD_DIRFILE
51 The supplied dirfile was invalid.
52
53 The dirfile error may be retrieved by calling get_error(3). A descrip‐
54 tive error string for the last error encountered can be obtained from a
55 call to get_error_string(3).
56
58 dirfile(5), dirfile_open(3), get_error(3), get_error_string(3),
59 get_field_list_by_type(3), get_mstrings(3), get_nfields_by_type(3)
60
61
62
63Version 0.5.0 8 December 2008 get_strings(3)