aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-17 10:53:22 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-17 11:05:42 +0200
commit1f980897f6947dd17eaa0190b2c1a23fb700636b (patch)
treecc46ed7f514323b9bd7bfb2f633dc4d17b99c091 /tests
parente3ef871d6a80d72db02c9ab1ef492e8f58c2ddeb (diff)
fstree: add support for spaces in filenames
This commit adds a mechanism to fstree_from_file to support filenames with spaces in them by quoting the entire string. Quote marks can still be used inside file names by escaping them with a backslash. Back slashes (if that is your thing) can also be escaped. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests')
-rw-r--r--tests/fstree_from_file.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/fstree_from_file.c b/tests/fstree_from_file.c
index c5b9b5b..f4fc345 100644
--- a/tests/fstree_from_file.c
+++ b/tests/fstree_from_file.c
@@ -14,6 +14,8 @@ static const char *testdesc =
"nod /chardev 0600 6 7 c 13 37\n"
"nod /blkdev 0600 8 9 b 42 21\n"
"pipe /pipe 0644 10 11\n"
+"dir \"/foo bar\" 0755 0 0\n"
+"dir \"/foo bar/ test \\\"/\" 0755 0 0\n"
" sock /sock 0555 12 13 ";
int main(void)
@@ -56,6 +58,20 @@ int main(void)
assert(n->data.dir->children == NULL);
n = n->next;
+ assert(n->mode == (S_IFDIR | 0755));
+ assert(n->uid == 0);
+ assert(n->gid == 0);
+ assert(strcmp(n->name, "foo bar") == 0);
+ assert(n->data.dir->children != NULL);
+
+ assert(n->data.dir->children->next == NULL);
+ assert(n->data.dir->children->mode == (S_IFDIR | 0755));
+ assert(n->data.dir->children->uid == 0);
+ assert(n->data.dir->children->gid == 0);
+ assert(strcmp(n->data.dir->children->name, " test \"") == 0);
+ assert(n->data.dir->children->data.dir->children == NULL);
+
+ n = n->next;
assert(n->mode == (S_IFIFO | 0644));
assert(n->uid == 10);
assert(n->gid == 11);