summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vind.c11
1 files changed, 7 insertions, 4 deletions
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;