From c52635fce35aa7d2e4414a44bac9fe06dfb56885 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 17 Dec 2018 22:05:49 -0500 Subject: Implement -acl test --- parse.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'parse.c') diff --git a/parse.c b/parse.c index a1b60e3..554d56b 100644 --- a/parse.c +++ b/parse.c @@ -922,6 +922,22 @@ static struct expr *parse_access(struct parser_state *state, int flag, int arg2) return expr; } +/** + * Parse -acl. + */ +static struct expr *parse_acl(struct parser_state *state, int flag, int arg2) { +#if BFS_HAS_SYS_ACL + struct expr *expr = parse_nullary_test(state, eval_acl); + if (expr) { + expr->cost = 2*STAT_COST; + } + return expr; +#else + cfprintf(state->cmdline->cerr, "%{er}error: %s is missing platform support.%{rs}\n", state->argv[0]); + return NULL; +#endif +} + /** * Parse -[aBcm]?newer. */ @@ -2438,6 +2454,8 @@ static struct expr *parse_help(struct parser_state *state, int arg1, int arg2) { cfprintf(cout, " %{cyn}-f%{rs} %{mag}PATH%{rs}\n"); cfprintf(cout, " Treat %{mag}PATH%{rs} as a path to search (useful if begins with a dash)\n\n"); + cfprintf(cout, " %{blu}-acl%{rs}\n"); + cfprintf(cout, " Find files with non-trivial Access Control Lists\n"); cfprintf(cout, " %{blu}-Bmin%{rs} %{bld}[-+]N%{rs}\n"); cfprintf(cout, " %{blu}-Btime%{rs} %{bld}[-+]N%{rs}\n"); cfprintf(cout, " Find files Birthed %{bld}N%{rs} minutes/days ago\n"); @@ -2538,6 +2556,7 @@ static const struct table_entry parse_table[] = { {"-L", false, parse_follow, BFTW_LOGICAL | BFTW_DETECT_CYCLES, false}, {"-X", false, parse_xargs_safe}, {"-a"}, + {"-acl", false, parse_acl}, {"-amin", false, parse_time, BFS_STAT_ATIME, MINUTES}, {"-and"}, {"-anewer", false, parse_newer, BFS_STAT_ATIME}, -- cgit v1.2.3