sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 191f7e693b16dfc0f6242c4247ceded99e69878c
parent 63271b47f7e045cdee3fa90178560f982b70c218
Author: Michael Forney <mforney@mforney.org>
Date:   Wed, 19 Oct 2022 20:29:14 -0700

find: insert -a in before open parens as well

This fixes expressions like -type f '(' -name foo -o -name bar ')'.

Diffstat:
Mfind.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 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++; }