From 191f7e693b16dfc0f6242c4247ceded99e69878c Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 19 Oct 2022 20:29:14 -0700 Subject: [PATCH] find: insert -a in before open parens as well This fixes expressions like -type f '(' -name foo -o -name bar ')'. --- find.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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++; }