Provided by: libgetdata-doc_0.10.0-5build2_all
gd_match_entries — search the entry list of a Dirfile
#include <getdata.h> unsigned int gd_match_entries(DIRFILE *dirfile, const char *regex, int fragment, int type, unsigned int flags, const char ***entries);
Upon successful completion, gd_match_entries() returns the number of entries successfully matched. In this case, if entries is non-NULL, this function sets *entries to a pointer to a list of the matching entry names. This list is terminated by a NULL pointer. Memory for the list, and for the strings it contains, is managed by GetData. None of the returned pointers should be free'd by the caller. The pointers returned are only valid until this function is called again, and the associated memory will be deallocated when dirfile is closed (see gd_close(3)). If no entries match, but no error occurs, zero is returned. In this case, if entries is non-NULL, *entries is still set to a non-NULL pointer, which points to a list containing only the terminating NULL. On error, this function also returns zero. If entries is non-NULL, *entries is set to NULL in this case (which can be used to distinguish this case from the zero-match case). This function furthermore stores a negative-valued error code in the DIRFILE object which may be retrieved by a subsequent call to gd_error(3). Possible error codes are: GD_E_ARGUMENT There was an error in the supplied regular expression. See the REGULAR EXPRESSION section below for details. GD_E_BAD_CODE The supplied parent field code was not found, or referred to a metafield itself. GD_E_BAD_DIRFILE The supplied dirfile was invalid. GD_E_BAD_ENTRY The type parameter supplied was not one of the symbols listed above. GD_E_UNSUPPORTED The regex parameter was non-NULL, but the library lacked support for the specified regular expression grammar. See the REGULAR EXPRESSION section below for details. A descriptive error string for the error may be obtained by calling gd_error_string(3).
The gd_match_entries() function appeared in GetData-0.10.0.
gd_entry_list(3), gd_error(3), gd_error_string(3), gd_hidden(3), gd_match_entries(3), gd_nentries(3), gd_open(3), dirfile(5)