commit 191f7e693b16dfc0f6242c4247ceded99e69878c
Author: Michael Forney <[email protected]>
AuthorDate: Wed Oct 19 20:29:14 2022 -0700
Commit: Michael Forney <[email protected]>
CommitDate: Fri Oct 21 18:31:52 2022 -0700
find: insert -a in before open parens as well
This fixes expressions like -type f '(' -name foo -o -name bar ')'.
diff --git a/find.c b/find.c
index 2b5e039..d4d7864 100644
--- a/find.c
+++ b/find.c
@@ -802,7 +802,8 @@ parse(int argc, char **argv)
} else if ((op = find_op(*arg))) { /* token is an operator */
if (lasttype == LPAR && op->type == RPAR)
eprintf("empty parens\n");
- if ((lasttype == PRIM || lasttype == RPAR) && op->type
== NOT) { /* need another implicit -a */
+ if ((lasttype == PRIM || lasttype == RPAR) &&
+ (op->type == NOT || op->type == LPAR)) { /* need
another implicit -a */
*tok++ = and;
ntok++;
}