From 1efa932e4aeb007eddb6424a90bf0fc05dba7e4d Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 23 Apr 2017 00:00:37 -0400 Subject: Implement -fstype Fixes #6! --- eval.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 8c33d21..5de25ec 100644 --- a/eval.c +++ b/eval.c @@ -13,6 +13,7 @@ #include "bftw.h" #include "color.h" #include "dstring.h" +#include "mtab.h" #include "util.h" #include #include @@ -366,6 +367,19 @@ done: return ret; } +/** + * -fstype test. + */ +bool eval_fstype(const struct expr *expr, struct eval_state *state) { + const struct stat *statbuf = fill_statbuf(state); + if (!statbuf) { + return false; + } + + const char *type = bfs_fstype(state->cmdline->mtab, statbuf); + return strcmp(type, expr->sdata) == 0; +} + /** * -hidden test. */ -- cgit v1.2.3