walk

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

commit 5267b0dc6058504fe8935f2e4ff3ab1d525024da
parent d091dce0ce59130cd14e970f065c3fa6fcae26b0
Author: Jacob R. Edwards <n/a>
Date:   Tue,  6 Dec 2022 10:39:56 -0600

Allow -x to be used with -f and -d

This can only be more useful and correct than the previous behavior,
although I'm not sure if the -x flag is suppost to work on directories
or not.

Diffstat:
Mwalk.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/walk.c b/walk.c @@ -300,15 +300,16 @@ main(int argc, char *argv[]) if (depth < min) continue; - if (exec) - show = access(ent->fts_accpath, X_OK) == 0; - else if (type == DIR) + if (type == DIR) show = S_ISDIR(ent->fts_statp->st_mode); else if (type == NOTDIR) show = !S_ISDIR(ent->fts_statp->st_mode); else show = 1; + if (exec) + show = show && access(ent->fts_accpath, X_OK) == 0; + if (show && printent(fmt, path, ent->fts_statp)) die(path); }