Xavier Del Campo Romero
59e17afe29
So far, cftw would search through all directories and files recursively, until all objects are processed. However, it is interesting for the user callback to be able to stop this process under specific circumstances. Now, cftw will pass a pointer to a bool, initialised to false by default, that can be optionally assigned to true by the user callback. Future commits will make use of this feature. For example, this will be used to limit the number of search results when a user enters a search term that is too generic and would otherwise generate a large amount of search results.
13 lines
347 B
C
13 lines
347 B
C
#ifndef CFTW_H
|
|
#define CFTW_H
|
|
|
|
#include <stdbool.h>
|
|
#include <sys/stat.h>
|
|
|
|
/* Thread-safe variant of ftw(3) and nftw(3) that allows passing an
|
|
* opaque pointer and removes some unneeded parameters. */
|
|
int cftw(const char *dirpath, int (*fn)(const char *fpath,
|
|
const struct stat *sb, bool *done, void *user), void *user);
|
|
|
|
#endif /* CFTW_H */
|