walk

A re-creation of the 9front utility walk(1) for UNIX
Log | Files | Refs

commit 76be48421e636f014eb88b51a99d27565eb58091
parent 6f32155892803fc214920feaea631754a26cf420
Author: Jacob R. Edwards <n/a>
Date:   Mon,  5 Dec 2022 13:05:11 -0600

Fix massive efficiency issue

Even if a maximum depth was set and prevented entries from being
displayed, they were still recursed over. Now every entry which
wasn't displayed due to the maximum depth option has FTS_SKIP set
on it.

Diffstat:
Mwalk.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/walk.c b/walk.c @@ -292,8 +292,11 @@ main(int argc, char *argv[]) } depth = ent->fts_level - 1; - if (max >= 0 && depth > max) + if (max >= 0 && depth > max) { + if (fts_set(fts, ent, FTS_SKIP)) + die("set skip"); continue; + } if (depth < min) continue;