aboutsummaryrefslogtreecommitdiff
path: root/cftw.h
blob: 645e08203116ccc04b1f02b4673a6c9e056a0e2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef CFTW_H
#define CFTW_H

#include <stdbool.h>
#include <sys/stat.h>

enum cftw_state
{
    CFTW_OK,
    CFTW_AGAIN,
    CFTW_FATAL
};

/* Thread-safe and non-blocking variant of ftw(3) and nftw(3) that allows
 * passing an opaque pointer and removes some unneeded parameters. */
struct cftw *cftw(const char *dirpath, int (*fn)(const char *fpath,
    const struct stat *sb, bool *done, void *user), void *user);
enum cftw_state cftw_step(struct cftw *c);
void cftw_free(struct cftw *c);

#endif /* CFTW_H */