Commit d5253365 authored by Ronald S. Bultje's avatar Ronald S. Bultje

tools/dav1d: abort on unused/unknown CLI arguments

parent 9e08ac71
...@@ -135,7 +135,7 @@ void parse(const int argc, char *const *const argv, ...@@ -135,7 +135,7 @@ void parse(const int argc, char *const *const argv,
dav1d_default_settings(lib_settings); dav1d_default_settings(lib_settings);
int grain_specified = 0; int grain_specified = 0;
while ((o = getopt_long(argc, argv, short_opts, long_opts, NULL)) >= 0) { while ((o = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) {
switch (o) { switch (o) {
case 'o': case 'o':
cli_settings->outputfile = optarg; cli_settings->outputfile = optarg;
...@@ -186,10 +186,12 @@ void parse(const int argc, char *const *const argv, ...@@ -186,10 +186,12 @@ void parse(const int argc, char *const *const argv,
fprintf(stderr, "%s\n", dav1d_version()); fprintf(stderr, "%s\n", dav1d_version());
exit(0); exit(0);
default: default:
break; usage(argv[0], NULL);
} }
} }
if (optind < argc)
usage(argv[0], "Extra/unused arguments found, e.g. '%s'\n", argv[optind]);
if (cli_settings->verify) { if (cli_settings->verify) {
if (cli_settings->outputfile) if (cli_settings->outputfile)
usage(argv[0], "Verification (--verify) requires output file (-o/--output) to not set"); usage(argv[0], "Verification (--verify) requires output file (-o/--output) to not set");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment