diff options
-rw-r--r-- | lib/fstree/fstree_from_file.c | 16 | ||||
-rw-r--r-- | tests/fstree_glob1.txt | 2 | ||||
-rw-r--r-- | tests/fstree_glob2.txt | 2 |
3 files changed, 17 insertions, 3 deletions
diff --git a/lib/fstree/fstree_from_file.c b/lib/fstree/fstree_from_file.c index 3663c1c..d852e0b 100644 --- a/lib/fstree/fstree_from_file.c +++ b/lib/fstree/fstree_from_file.c @@ -297,7 +297,21 @@ static int glob_files(fstree_t *fs, const char *filename, size_t line_num, continue; } - break; + if (extra[0] == '-') { + if (extra[1] == '-' && isspace(extra[2])) { + extra += 2; + while (isspace(*extra)) + ++extra; + break; + } + + fprintf(stderr, "%s: " PRI_SZ ": unknown option.\n", + filename, line_num); + free(ctx.name_pattern); + return -1; + } else { + break; + } } if (*extra == '\0') { diff --git a/tests/fstree_glob1.txt b/tests/fstree_glob1.txt index 28dbecb..0d96391 100644 --- a/tests/fstree_glob1.txt +++ b/tests/fstree_glob1.txt @@ -1,2 +1,2 @@ dir /tarcorpus 0755 0 0 -glob /tarcorpus 0755 0 0 -type d tar +glob /tarcorpus 0755 0 0 -type d -- tar diff --git a/tests/fstree_glob2.txt b/tests/fstree_glob2.txt index be30fcc..f423b4a 100644 --- a/tests/fstree_glob2.txt +++ b/tests/fstree_glob2.txt @@ -1,3 +1,3 @@ dir /tarcorpus 0755 0 0 glob /tarcorpus 0755 0 0 -type d tar -glob /tarcorpus 0644 0 0 -type f -name "*gnu*.tar" tar +glob /tarcorpus 0644 0 0 -type f -name "*gnu*.tar" -- tar |