diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2015-07-23 21:19:37 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2015-07-23 21:19:37 -0400 |
commit | ba034f0fd6343060eb03650504fe992843bc0261 (patch) | |
tree | ce08bbb037bbeb0ea7857bb682992b58a15bed49 /bftw.h | |
parent | a47cee3a89da7a2cff6b615e381fd486d5d9c06e (diff) | |
download | bfs-ba034f0fd6343060eb03650504fe992843bc0261.tar.xz |
bftw: New struct BFTW type to hold file attributes.
Like nftw()'s struct FTW. level is needed to implement -mindepth/
-maxdepth.
Diffstat (limited to 'bftw.h')
-rw-r--r-- | bftw.h | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -12,20 +12,32 @@ #include <sys/stat.h> /** + * Data about the current file for the bftw() callback. + */ +struct BFTW { + /** A stat() buffer; may be NULL if no stat() call was needed. */ + const struct stat *statbuf; + /** A typeflag value (see below). */ + int typeflag; + /** The string offset of the filename in the path. */ + int base; + /** The depth of this file in the walk. */ + int level; +}; + +/** * Callback function type for bftw(). * * @param fpath * The path to the encountered file. - * @param sb - * A stat() buffer; may be NULL if no stat() call was needed. - * @param typeflag - * A typeflag value (see below). + * @param ftwbuf + * Additional data about the current file. * @param ptr * The pointer passed to bftw(). * @return * An action value (see below). */ -typedef int bftw_fn(const char *fpath, const struct stat *sb, int typeflag, void *ptr); +typedef int bftw_fn(const char *fpath, const struct BFTW *ftwbuf, void *ptr); /** * Breadth First Tree Walk (or Better File Tree Walk). |