diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2015-11-26 10:40:04 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2015-11-26 10:40:04 -0500 |
commit | 527d0dc1506584f29bf760ed3b2e6363f8c50a2f (patch) | |
tree | ab45ad2f46998386b231f19868db385d6a04753a | |
parent | 4a24ca7003759f245a84754748f4e21f381bbb3d (diff) | |
download | bfs-527d0dc1506584f29bf760ed3b2e6363f8c50a2f.tar.xz |
Implement -quit.
-rw-r--r-- | bfs.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -378,6 +378,14 @@ static bool eval_print0(const expression *expr, eval_state *state) { } /** + * -quit action. + */ +static bool eval_quit(const expression *expr, eval_state *state) { + state->action = BFTW_STOP; + return true; +} + +/** * -type test. */ static bool eval_type(const expression *expr, eval_state *state) { @@ -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) { |