aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-05-26 05:30:25 -0500
committerRob Landley <rob@landley.net>2021-05-26 05:30:25 -0500
commite3062c3bd3666d4641481dbf436c72e3d46ab727 (patch)
tree7ffdc042d53083f5909edca98e4da805787ed42d /toys
parent293185e71e33274610e8b5801f7f41ff0c620edd (diff)
downloadtoybox-e3062c3bd3666d4641481dbf436c72e3d46ab727.tar.gz
Add find -quit
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/find.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/toys/posix/find.c b/toys/posix/find.c
index 3824f0c6..5d3f8e3e 100644
--- a/toys/posix/find.c
+++ b/toys/posix/find.c
@@ -37,6 +37,7 @@ config FIND
-true always true -false always false
-context PATTERN security context -executable access(X_OK) perm+ACL
-newerXY FILE X=acm time > FILE's Y=acm time (Y=t: FILE is literal time)
+ -quit exit immediately
Numbers N may be prefixed by a - (less than) or + (greater than). Units for
-Xtime are d (days, default), h (hours), m (minutes), or s (seconds).
@@ -352,6 +353,11 @@ static int do_find(struct dirtree *new)
if (check && S_ISDIR(new->st.st_mode) && !TT.depth) recurse = 0;
} else if (!strcmp(s, "executable")) {
if (check && faccessat(dirtree_parentfd(new), new->name,X_OK,0)) test = 0;
+ } else if (!strcmp(s, "quit")) {
+ if (check) {
+ execdir(0, 1);
+ xexit();
+ }
// Remaining filters take an argument
} else {