diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2021-02-18 11:38:44 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2021-02-19 17:35:07 +0100 |
commit | d7409bbc5e24267b275692b48116254d842d3821 (patch) | |
tree | 8fba327aa3461dac5a6924270e0a64606a6c64ee /tests/fstree_from_dir.c | |
parent | 94269ff3c0166474c018c4973c481b2fcff00080 (diff) |
fstree_from_file: Implement basic file globbing
The base path is passed to the fstree_from_file function and in turn
to the individual callbacks.
The line parsing function is modified to allow '*' as mode, uid and gid
for specifically marked callbacks.
A glob callback is added that internally uses the fstree_from_dir scanning
functions in combination with a filter callback.
Directory scanning flags are parsed from the extra arguments before
interpreting it as a path fragment.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/fstree_from_dir.c')
-rw-r--r-- | tests/fstree_from_dir.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/fstree_from_dir.c b/tests/fstree_from_dir.c index 8e08aeb..af48d4d 100644 --- a/tests/fstree_from_dir.c +++ b/tests/fstree_from_dir.c @@ -321,7 +321,8 @@ int main(void) /* recursively scan into root */ TEST_ASSERT(fstree_init(&fs, NULL) == 0); - TEST_ASSERT(fstree_from_dir(&fs, fs.root, TEST_PATH, 0) == 0); + TEST_ASSERT(fstree_from_dir(&fs, fs.root, TEST_PATH, + NULL, NULL, 0) == 0); fstree_post_process(&fs); check_hierarchy(fs.root, true); @@ -329,8 +330,8 @@ int main(void) /* non-recursively scan into root */ TEST_ASSERT(fstree_init(&fs, NULL) == 0); - TEST_ASSERT(fstree_from_dir(&fs, fs.root, - TEST_PATH, DIR_SCAN_NO_RECURSION) == 0); + TEST_ASSERT(fstree_from_dir(&fs, fs.root, TEST_PATH, NULL, NULL, + DIR_SCAN_NO_RECURSION) == 0); fstree_post_process(&fs); check_hierarchy(fs.root, false); @@ -346,7 +347,7 @@ int main(void) TEST_NOT_NULL(n); fs.root->data.dir.children = n; - TEST_ASSERT(fstree_from_dir(&fs, n, TEST_PATH, 0) == 0); + TEST_ASSERT(fstree_from_dir(&fs, n, TEST_PATH, NULL, NULL, 0) == 0); TEST_ASSERT(fs.root->data.dir.children == n); TEST_NULL(n->next); @@ -365,8 +366,8 @@ int main(void) TEST_NOT_NULL(n); fs.root->data.dir.children = n; - TEST_ASSERT(fstree_from_dir(&fs, n, - TEST_PATH, DIR_SCAN_NO_RECURSION) == 0); + TEST_ASSERT(fstree_from_dir(&fs, n, TEST_PATH, NULL, NULL, + DIR_SCAN_NO_RECURSION) == 0); TEST_ASSERT(fs.root->data.dir.children == n); TEST_NULL(n->next); |