summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-03-21 11:48:06 -0400
committerTavian Barnes <tavianator@tavianator.com>2020-03-21 12:05:14 -0400
commit352b9eaf4479d204c617c68744de9ba075078308 (patch)
treec67cb5e4389c9ae00e3e748cd1dd8002911f44f8 /parse.c
parentaacf8aa796c3120ff65e3c0a2cbdddcf60c1777e (diff)
downloadbfs-352b9eaf4479d204c617c68744de9ba075078308.tar.xz
Implement -s flag from FreeBSD find to sort results
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 5851430..8e52999 100644
--- a/parse.c
+++ b/parse.c
@@ -2221,6 +2221,14 @@ list_types:
}
/**
+ * Parse -s.
+ */
+static struct expr *parse_s(struct parser_state *state, int arg1, int arg2) {
+ state->cmdline->flags |= BFTW_SORT;
+ return parse_nullary_flag(state);
+}
+
+/**
* Parse -samefile FILE.
*/
static struct expr *parse_samefile(struct parser_state *state, int arg1, int arg2) {
@@ -2651,6 +2659,8 @@ static struct expr *parse_help(struct parser_state *state, int arg1, int arg2) {
cfprintf(cout, " Filter out files with non-${ex}xargs${rs}-safe names\n");
cfprintf(cout, " ${cyn}-d${rs}\n");
cfprintf(cout, " Search in post-order (same as ${blu}-depth${rs})\n");
+ cfprintf(cout, " ${cyn}-s${rs}\n");
+ cfprintf(cout, " Visit directory entries in sorted order\n");
cfprintf(cout, " ${cyn}-x${rs}\n");
cfprintf(cout, " Don't descend into other mount points (same as ${blu}-xdev${rs})\n");
@@ -2991,6 +3001,7 @@ static const struct table_entry parse_table[] = {
{"-regex", parse_regex, 0},
{"-regextype", parse_regextype},
{"-rm", parse_delete},
+ {"-s", parse_s},
{"-samefile", parse_samefile},
{"-since", parse_since, BFS_STAT_MTIME},
{"-size", parse_size},