summaryrefslogtreecommitdiffstats
path: root/bfs.c
diff options
context:
space:
mode:
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;
}