find: insert -a in before open parens as well

This fixes expressions like -type f '(' -name foo -o -name bar ')'.
This commit is contained in:
Michael Forney 2022-10-19 20:29:14 -07:00
parent 63271b47f7
commit 191f7e693b
1 changed files with 2 additions and 1 deletions

3
find.c
View File

@ -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++;
}