[hackers] [sbase] find: insert -a in before open parens as well || Michael Forney

From: <git_AT_suckless.org>
Date: Sat, 22 Oct 2022 03:35:16 +0200 (CEST)

commit 191f7e693b16dfc0f6242c4247ceded99e69878c
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Wed Oct 19 20:29:14 2022 -0700
Commit: Michael Forney <mforney_AT_mforney.org>
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
_AT_@ -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++;
                         }
Received on Sat Oct 22 2022 - 03:35:16 CEST

This archive was generated by hypermail 2.3.0 : Sat Oct 22 2022 - 03:36:35 CEST