From c32d99a08880522216ae7a585beba09f03ef1f4d Mon Sep 17 00:00:00 2001 From: aqnuep <33791085+aqnuep@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:28:28 +0100 Subject: [PATCH] Report error on excess filenames (#843) Fixes #842. CTS PR: https://github.com/KhronosGroup/KTX-Software-CTS/pull/15. --- tests/cts | 2 +- tools/ktx/command.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/cts b/tests/cts index b36957e023..e04c6428f1 160000 --- a/tests/cts +++ b/tests/cts @@ -1 +1 @@ -Subproject commit b36957e02362a9a7760a94d0572d2dbe85a7c039 +Subproject commit e04c6428f17c67f06eac7d77babd7198e2cbecc3 diff --git a/tools/ktx/command.h b/tools/ktx/command.h index 75bf46df58..50edaf742c 100644 --- a/tools/ktx/command.h +++ b/tools/ktx/command.h @@ -246,6 +246,9 @@ struct OptionsSingleIn { } void process(cxxopts::Options&, cxxopts::ParseResult& args, Reporter& report) { + if (!args.unmatched().empty()) + report.fatal_usage("Too many filenames specified."); + if (args.count("stdin") + args.count("input-file") == 0) report.fatal_usage("Missing input file. Either or --stdin must be specified."); if (args.count("stdin") + args.count("input-file") > 1) @@ -273,6 +276,9 @@ struct OptionsSingleInSingleOut { } void process(cxxopts::Options&, cxxopts::ParseResult& args, Reporter& report) { + if (!args.unmatched().empty()) + report.fatal_usage("Too many filenames specified."); + if (args.count("stdin") + args.count("input-file") == 0) report.fatal_usage("Missing input file. Either or --stdin must be specified."); if (args.count("stdin") + args.count("input-file") > 1)