perf tools: Enhance the matching of sub-commands abbreviations
[linux-2.6-microblaze.git] / tools / perf / builtin-c2c.c
index 14f787c..fbbed43 100644 (file)
@@ -44,6 +44,7 @@
 #include "../perf.h"
 #include "pmu.h"
 #include "pmu-hybrid.h"
+#include "string2.h"
 
 struct c2c_hists {
        struct hists            hists;
@@ -3025,9 +3026,9 @@ int cmd_c2c(int argc, const char **argv)
        if (!argc)
                usage_with_options(c2c_usage, c2c_options);
 
-       if (!strncmp(argv[0], "rec", 3)) {
+       if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) {
                return perf_c2c__record(argc, argv);
-       } else if (!strncmp(argv[0], "rep", 3)) {
+       } else if (strlen(argv[0]) > 2 && strstarts("report", argv[0])) {
                return perf_c2c__report(argc, argv);
        } else {
                usage_with_options(c2c_usage, c2c_options);