From 7a89cbed47ff162812351ebf7a97ad36823b3dd7 Mon Sep 17 00:00:00 2001 From: Lieuwe Rooijakkers Date: Mon, 12 Aug 2024 18:11:41 +0200 Subject: vind: some comments --- src/vind.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/vind.c') diff --git a/src/vind.c b/src/vind.c index 445613f..acca1ef 100644 --- a/src/vind.c +++ b/src/vind.c @@ -94,21 +94,24 @@ static char** parse_options(int argc, char **argv) { } static int f(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) { - bool skip = false; + // check filetype + bool ftskip = false; switch (typeflag) { case FTW_F: - skip = !(ftmap == 0 || (ftmap & FT_FILE)); + ftskip = !(ftmap == 0 || (ftmap & FT_FILE)); break; case FTW_D: case FTW_DNR: case FTW_DP: - skip = !(ftmap == 0 || (ftmap & FT_DIR)); + ftskip = !(ftmap == 0 || (ftmap & FT_DIR)); break; } + if (ftskip) return 0; - if (skip) return 0; + // check max depth if (max_depth >= 0 && ftwbuf->level >= max_depth) return 0; + // check file size if (sb->st_size < min_size) return 0; if (sb->st_size > max_size) return 0; -- cgit v1.2.3-70-g09d2