diff options
-rw-r--r-- | src/parse.c | 18 | ||||
-rw-r--r-- | tests/bfs/files0_from_root.sh | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/parse.c b/src/parse.c index 58a900f..9c39d6b 100644 --- a/src/parse.c +++ b/src/parse.c @@ -3521,7 +3521,25 @@ static struct bfs_expr *parse_expr(struct bfs_parser *parser) { /** Handle -files0-from after parsing. */ static int parse_files0_roots(struct bfs_parser *parser) { + const struct bfs_ctx *ctx = parser->ctx; const struct bfs_expr *expr = parser->files0_expr; + + if (ctx->npaths > 0) { + bool highlight[ctx->argc]; + init_highlight(ctx, highlight); + highlight_args(ctx, expr->argv, expr->argc, highlight); + + for (size_t i = 0; i < ctx->argc; ++i) { + if (ctx->kinds[i] == BFS_PATH) { + highlight[i] = true; + } + } + + bfs_argv_error(ctx, highlight); + bfs_error(ctx, "Cannot combine %pX with explicit root paths.\n", expr); + return -1; + } + const char *from = expr->argv[1]; FILE *file; diff --git a/tests/bfs/files0_from_root.sh b/tests/bfs/files0_from_root.sh new file mode 100644 index 0000000..6ba5f00 --- /dev/null +++ b/tests/bfs/files0_from_root.sh @@ -0,0 +1,2 @@ +printf 'basic\0' >"$TEST/input" +! invoke_bfs basic -files0-from "$TEST/input" |