perf tools: Enhance the matching of sub-commands abbreviations
[linux-2.6-microblaze.git] / tools / perf / builtin-script.c
index f12dc5e..a2f1179 100644 (file)
@@ -3922,13 +3922,13 @@ int cmd_script(int argc, const char **argv)
        if (symbol__validate_sym_arguments())
                return -1;
 
-       if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) {
+       if (argc > 1 && strlen(argv[0]) > 2 && strstarts("record", argv[0])) {
                rec_script_path = get_script_path(argv[1], RECORD_SUFFIX);
                if (!rec_script_path)
                        return cmd_record(argc, argv);
        }
 
-       if (argc > 1 && !strncmp(argv[0], "rep", strlen("rep"))) {
+       if (argc > 1 && strlen(argv[0]) > 2 && strstarts("report", argv[0])) {
                rep_script_path = get_script_path(argv[1], REPORT_SUFFIX);
                if (!rep_script_path) {
                        fprintf(stderr,