summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2015-11-26 10:40:04 -0500
committerTavian Barnes <tavianator@tavianator.com>2015-11-26 10:40:04 -0500
commit527d0dc1506584f29bf760ed3b2e6363f8c50a2f (patch)
treeab45ad2f46998386b231f19868db385d6a04753a
parent4a24ca7003759f245a84754748f4e21f381bbb3d (diff)
downloadbfs-527d0dc1506584f29bf760ed3b2e6363f8c50a2f.tar.xz
Implement -quit.
-rw-r--r--bfs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/bfs.c b/bfs.c
index a203468..4303a77 100644
--- a/bfs.c
+++ b/bfs.c
@@ -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) {