From 6d84edf84c184db1ef01243320441f7111ffb548 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sun, 12 Nov 2017 21:19:48 +0100 Subject: revert making prune be false This makes things more confusing in the end (and is not how find(1) works either). --- NEWS.md | 3 --- lr.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index c2b61f3..6b2968e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,5 @@ ## HEAD -* **Breaking change**: `prune` now evaluates to a false value. - The common find(1) idiom is now best written as `name = "x" ? prune : print`. - * Feature: new option `-B` for breadth first traversal. * Feature: new syntax `? :` for ternary operator. * Significant speed-up as tsearch is not used anymore. diff --git a/lr.c b/lr.c index d5fff03..87aefb4 100644 --- a/lr.c +++ b/lr.c @@ -1273,7 +1273,7 @@ eval(struct expr *e, struct fileinfo *fi) return !eval(e->a.expr, fi); case EXPR_PRUNE: prune = 1; - return 0; + return 1; case EXPR_PRINT: return 1; case EXPR_COLOR: @@ -2290,7 +2290,7 @@ main(int argc, char *argv[]) while ((c = getopt(argc, argv, "01ABC:DFGHLQST:UXde:f:lho:st:x")) != -1) switch (c) { case '0': format = zero_format; input_delim = 0; Qflag = 0; break; - case '1': expr = chain(parse_expr("depth > 0 && prune || print"), EXPR_AND, expr); break; + case '1': expr = chain(parse_expr("depth > 0 ? prune : print"), EXPR_AND, expr); break; case 'A': expr = chain(expr, EXPR_AND, parse_expr("name =~ \"^\\.\" && path != \".\" ? prune : print")); break; case 'B': Bflag++; Dflag = 0; Uflag = 0; need_stat++; break; case 'C': -- cgit 1.4.1