From: Carl Worth Date: Tue, 4 Sep 2012 23:48:00 +0000 (-0700) Subject: trim: Complain if given extraneous arguments. X-Git-Url: https://git.cworth.org/git?p=apitrace;a=commitdiff_plain;h=f630d9d87c8758269a9b1aeec2db008cbc105b60 trim: Complain if given extraneous arguments. Previously additional arguments were silently ignored, (which can lead to confusion if the user expects to be able to specify a bare callset on the command line rather than specifying a --calls option). --- diff --git a/cli/cli_trim.cpp b/cli/cli_trim.cpp index c54565f..75670af 100644 --- a/cli/cli_trim.cpp +++ b/cli/cli_trim.cpp @@ -253,6 +253,16 @@ command(int argc, char *argv[]) return 1; } + if (argc > optind + 1) { + std::cerr << "error: extraneous arguments:"; + for (int i = optind + 1; i < argc; i++) { + std::cerr << " " << argv[i]; + } + std::cerr << "\n"; + usage(); + return 1; + } + return trim_trace(argv[optind], &options); }