summaryrefslogtreecommitdiff
path: root/src/vind.c
diff options
context:
space:
mode:
authorLieuwe Rooijakkers <lieuwerooijakkers@gmail.com>2024-08-12 18:11:41 +0200
committerLieuwe Rooijakkers <lieuwerooijakkers@gmail.com>2024-08-12 18:11:42 +0200
commit7a89cbed47ff162812351ebf7a97ad36823b3dd7 (patch)
tree62ede5fef80771da0db9ca0e15c5f104e88dbf6e /src/vind.c
parent8fe4e60fac443ea285c31b6fa3c4e8f913cceb57 (diff)
vind: some comments
Diffstat (limited to 'src/vind.c')
-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;