aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/find/function.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/find/function.c')
-rw-r--r--usr.bin/find/function.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index 38bf813510d3..f1c473ea240a 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -76,6 +76,8 @@ static char *nextarg(OPTION *, char ***);
extern char **environ;
+static PLAN *lastexecplus = NULL;
+
#define COMPARE(a, b) do { \
switch (plan->flags & F_ELG_MASK) { \
case F_EQUAL: \
@@ -711,6 +713,8 @@ c_exec(OPTION *option, char ***argvp)
new->e_psizemax = argmax;
new->e_pbsize = 0;
cnt += new->e_pnummax + 1;
+ new->e_next = lastexecplus;
+ lastexecplus = new;
}
if ((new->e_argv = malloc(cnt * sizeof(char *))) == NULL)
err(1, NULL);
@@ -754,6 +758,19 @@ done: *argvp = argv + 1;
return new;
}
+/* Finish any pending -exec ... {} + functions. */
+void
+finish_execplus()
+{
+ PLAN *p;
+
+ p = lastexecplus;
+ while (p != NULL) {
+ (p->execute)(p, NULL);
+ p = p->e_next;
+ }
+}
+
int
f_flags(PLAN *plan, FTSENT *entry)
{