slcl/cftw.h
Xavier Del Campo Romero 804b8841f3
Add cftw
POSIX functions ftw(3) and nftw(3) do not allow passing an opaque
pointer to the callback they call, so it forces the use of statically
allocated data.

ctfw (from "custom ftw") is a custom implementation that solves this,
while also removing unneeded stuff.

This function will be used by future commits.
2023-03-06 05:06:30 +01:00

12 lines
314 B
C

#ifndef CFTW_H
#define CFTW_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, void *user), void *user);
#endif /* CFTW_H */