summaryrefslogtreecommitdiffstats
path: root/bfs.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2015-07-23 21:19:37 -0400
committerTavian Barnes <tavianator@tavianator.com>2015-07-23 21:19:37 -0400
commitba034f0fd6343060eb03650504fe992843bc0261 (patch)
treece08bbb037bbeb0ea7857bb682992b58a15bed49 /bfs.c
parenta47cee3a89da7a2cff6b615e381fd486d5d9c06e (diff)
downloadbfs-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.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/bfs.c b/bfs.c
index c637ba3..a3a969c 100644
--- a/bfs.c
+++ b/bfs.c
@@ -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;
}