From f1fb3158d3f242f1884d8d8a7473ab0719e93e8c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 23 May 2019 17:13:39 -0400 Subject: Implement -xattr predicate --- parse.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'parse.c') diff --git a/parse.c b/parse.c index dbca7a9..4379e7a 100644 --- a/parse.c +++ b/parse.c @@ -2337,6 +2337,23 @@ static struct expr *parse_warn(struct parser_state *state, int warn, int arg2) { return parse_nullary_positional_option(state); } +/** + * 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. */ @@ -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}, {"--"}, -- cgit v1.2.3