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 /bfs.c | |
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 'bfs.c')
-rw-r--r-- | bfs.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -23,17 +23,16 @@ typedef struct { bool hidden; } options; -static int callback(const char *fpath, const struct stat *sb, int typeflag, void *ptr) { +static int callback(const char *fpath, const struct BFTW* ftwbuf, void *ptr) { const options *opts = ptr; if (!opts->hidden) { - const char *filename = strrchr(fpath, '/'); - if (filename && filename[1] == '.') { + if (ftwbuf->base > 0 && fpath[ftwbuf->base] == '.') { return BFTW_SKIP_SUBTREE; } } - pretty_print(opts->colors, fpath, sb); + pretty_print(opts->colors, fpath, ftwbuf->statbuf); return BFTW_CONTINUE; } |