From 4e29ac9d031d623b9bdb74f45ac5c14f9f2eadbd Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 8 Sep 2015 14:54:15 -0400 Subject: 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. --- bfs.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bfs.c') 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) { -- cgit v1.2.3