From 527d0dc1506584f29bf760ed3b2e6363f8c50a2f Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 26 Nov 2015 10:40:04 -0500 Subject: Implement -quit. --- bfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bfs.c b/bfs.c index a203468..4303a77 100644 --- a/bfs.c +++ b/bfs.c @@ -377,6 +377,14 @@ static bool eval_print0(const expression *expr, eval_state *state) { return true; } +/** + * -quit action. + */ +static bool eval_quit(const expression *expr, eval_state *state) { + state->action = BFTW_STOP; + return true; +} + /** * -type test. */ @@ -547,6 +555,8 @@ static expression *parse_literal(parser_state *state) { return new_action(state, eval_print0); } else if (strcmp(arg, "-prune") == 0) { return new_action(state, eval_prune); + } else if (strcmp(arg, "-quit") == 0) { + return new_action(state, eval_quit); } else if (strcmp(arg, "-true") == 0) { return &expr_true; } else if (strcmp(arg, "-type") == 0) { -- cgit v1.2.3