walk

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

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

Ignore the current directory when given no paths

One nice thing about walk is that if you don't specify any path
arguments, it will show the current directory without ./ prefixed
to every entry. That said there was an oversight in that, underneath,
'.' was specified explicitly to fts_open(3), causing fts_read(3)
to return '.'. Now it's specially ignored (but I'm not too happy
about how there are two different paths of execution running
side-by-side to provide the aforementioned ability, it may need
work).

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

diff --git a/walk.c b/walk.c @@ -281,7 +281,10 @@ main(int argc, char *argv[]) die("fts open"); while ((ent = fts_read(fts))) { + if (offset && strcmp(ent->fts_path, ".") == 0) + continue; path = ent->fts_path + offset; + switch (ent->fts_info) { case FTS_DNR: case FTS_ERR: