summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-04-23 00:00:37 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-04-23 00:17:49 -0400
commit1efa932e4aeb007eddb6424a90bf0fc05dba7e4d (patch)
tree288ae5aa5385f985cbd4818497e01cf845591617 /eval.c
parent8df078ada9045ffceb541e224985a4e4191e1526 (diff)
downloadbfs-1efa932e4aeb007eddb6424a90bf0fc05dba7e4d.tar.xz
Implement -fstype
Fixes #6!
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c14
1 files changed, 14 insertions, 0 deletions
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 <assert.h>
#include <dirent.h>
@@ -367,6 +368,19 @@ done:
}
/**
+ * -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.
*/
bool eval_hidden(const struct expr *expr, struct eval_state *state) {