#include <db.h> int db_env_set_func_dirlist(int (*func_dirlist)(const char *dir, char ***namesp, int *cntp));
The Berkeley DB library requires the ability to read through a directory and create a list of files that the directory contains.
The db_env_set_func_dirlist method configures all operations performed by a process and all of its threads of control, not operations confined to a single database environment.
Although the db_env_set_func_dirlist method may be called at any time during the life of the application, it should normally be called before making calls to the db_env_create or db_create methods.
The db_env_set_func_dirlist()
function returns a non-zero error value on failure and 0 on success.
The func_dirlist parameter is the function which reads through a directory and returns a list of the files it contains.
The dir parameter to this function is the name of the directory to be searched.
The function must return a pointer to an array of nul-terminated file names into the memory location to which the namesp parameter refers, and a count of the number of elements in the array into the memory location to which cntp refers.