diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2020-06-20 11:30:56 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2020-06-20 11:30:56 -0700 |
commit | 955516759cfed29122439938632964fed4f8a347 (patch) | |
tree | 6cc0c6300e2b3d5b4e0c08103ecd9c9e939bc1c8 /sys/libn | |
parent | 91c673b37782d4cd90e5cf9a8e4491723e6c04bf (diff) |
feat: file globbing in shell. added dynamic.mk
Diffstat (limited to 'sys/libn')
-rw-r--r-- | sys/libn/fs.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/libn/fs.c b/sys/libn/fs.c index 5d06997..10cd93e 100644 --- a/sys/libn/fs.c +++ b/sys/libn/fs.c @@ -6,7 +6,6 @@ /* * path history */ - struct Key { ino_t ino; @@ -151,9 +150,14 @@ fs·walk(fs·Walker *fs) return; } - /* operate on directory if preorder traversal */ - if (fs->flags & fs·preorder) - fs->func(fs->data, fs->base, fs->path, &cwd); + /* + * operate on directory first if preorder traversal + * truncate recursion if callback returns an error code + */ + if (fs->flags & fs·preorder) { + if (fs->func(fs->data, fs->base, fs->path, &cwd)) + return; + } /* open directory */ if(!fs->max || fs->lev + 1 < fs->max) { |