if (sd->taken)
continue;
- if (strcmp(tok, sd->name))
+ if (strncasecmp(tok, sd->name, strlen(tok)))
continue;
list_add_tail(&sd->entry->list, &hist_entry__sort_list);
sd->taken = 1;
+
return 0;
}
return -ESRCH;
}
-static void setup_sorting(void)
-{
- char *tmp, *tok, *str = strdup(sort_order);
-
- for (tok = strtok_r(str, ", ", &tmp);
- tok; tok = strtok_r(NULL, ", ", &tmp))
- sort_dimension__add(tok);
-
- free(str);
-}
-
static int64_t
hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
{
OPT_END()
};
+static void setup_sorting(void)
+{
+ char *tmp, *tok, *str = strdup(sort_order);
+
+ for (tok = strtok_r(str, ", ", &tmp);
+ tok; tok = strtok_r(NULL, ", ", &tmp)) {
+ if (sort_dimension__add(tok) < 0) {
+ error("Unknown --sort key: `%s'", tok);
+ usage_with_options(report_usage, options);
+ }
+ }
+
+ free(str);
+}
+
int cmd_report(int argc, const char **argv, const char *prefix)
{
symbol__init();