summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-05-23 17:13:39 -0400
committerTavian Barnes <tavianator@tavianator.com>2019-05-24 09:00:51 -0400
commitf1fb3158d3f242f1884d8d8a7473ab0719e93e8c (patch)
tree4ab193109db3da98b779ed807f40adb3bb0b9fbd /parse.c
parentd9b3196d6c8f4fa0e7d0a4771040762edaebb1ee (diff)
downloadbfs-f1fb3158d3f242f1884d8d8a7473ab0719e93e8c.tar.xz
Implement -xattr predicate
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index dbca7a9..4379e7a 100644
--- a/parse.c
+++ b/parse.c
@@ -2338,6 +2338,23 @@ static struct expr *parse_warn(struct parser_state *state, int warn, int arg2) {
}
/**
+ * Parse -xattr.
+ */
+static struct expr *parse_xattr(struct parser_state *state, int arg1, int arg2) {
+#if BFS_CAN_CHECK_XATTRS
+ struct expr *expr = parse_nullary_test(state, eval_xattr);
+ if (expr) {
+ expr->cost = STAT_COST;
+ expr->probability = 0.01;
+ }
+ return expr;
+#else
+ parse_error(state, "%s is missing platform support.\n", state->argv[0]);
+ return NULL;
+#endif
+}
+
+/**
* "Parse" -help.
*/
static struct expr *parse_help(struct parser_state *state, int arg1, int arg2) {
@@ -2692,6 +2709,7 @@ static const struct table_entry parse_table[] = {
{"-wholename", false, parse_path, false},
{"-writable", false, parse_access, W_OK},
{"-x", false, parse_mount},
+ {"-xattr", false, parse_xattr},
{"-xdev", false, parse_mount},
{"-xtype", false, parse_type, true},
{"--"},