[PATCH 1/2] trim: Complain if given extraneous arguments.

Carl Worth cworth at cworth.org
Wed Sep 5 10:03:17 PDT 2012


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).
---
 cli/cli_trim.cpp |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/cli/cli_trim.cpp b/cli/cli_trim.cpp
index 22d4178..16699f1 100644
--- a/cli/cli_trim.cpp
+++ b/cli/cli_trim.cpp
@@ -377,6 +377,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;
+    }
+
     if (options.dependency_analysis) {
         std::cerr <<
             "Note: The dependency analysis in \"apitrace trim\" is still experimental.\n"
-- 
1.7.10



More information about the apitrace mailing list