summaryrefslogtreecommitdiffstats
path: root/bfs.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2015-09-08 14:54:15 -0400
committerTavian Barnes <tavianator@tavianator.com>2015-09-08 17:04:53 -0400
commit4e29ac9d031d623b9bdb74f45ac5c14f9f2eadbd (patch)
tree3bbbd7f40b543e14229a85e5e64b8c8f1bcc0c6d /bfs.c
parent3c04b862ff35e2c040adbdb4d17310bff1f8cb35 (diff)
downloadbfs-4e29ac9d031d623b9bdb74f45ac5c14f9f2eadbd.tar.xz
Add -depth support.
The resulting order is fairly weird, as files are still returned in breadth-first order, but directories are returned in a backwards order based on when their reference counts drop to zero. But it's good enough for -delete support.
Diffstat (limited to 'bfs.c')
-rw-r--r--bfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bfs.c b/bfs.c
index 7090817..986c895 100644
--- a/bfs.c
+++ b/bfs.c
@@ -450,6 +450,9 @@ static expression *parse_literal(parser_state *state) {
} else if (strcmp(arg, "-nocolor") == 0) {
state->cl->color = false;
return new_option(state);
+ } else if (strcmp(arg, "-depth") == 0) {
+ state->cl->flags |= BFTW_DEPTH;
+ return new_option(state);
} else if (strcmp(arg, "-false") == 0) {
return new_test(state, eval_false);
} else if (strcmp(arg, "-hidden") == 0) {