From cc91fd51ffdb7ea04369836abda7661f3da00364 Mon Sep 17 00:00:00 2001 From: John Thacker Date: Thu, 14 Oct 2021 19:54:01 -0400 Subject: cli: stats_tree: Make syntax consistent with other -z options The statistics that use the stats_tree API parse the -z option without expecting a comma separator between the statistics name and the filter. This is contrary to both the man pages and how all the other options work. Fix that so it's consistent. Fix #17656 --- ui/cli/tap-stats_tree.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ui/cli') diff --git a/ui/cli/tap-stats_tree.c b/ui/cli/tap-stats_tree.c index ecdb3b6b61..64557e40d4 100644 --- a/ui/cli/tap-stats_tree.c +++ b/ui/cli/tap-stats_tree.c @@ -55,13 +55,19 @@ init_stats_tree(const char *opt_arg, void *userdata _U_) GString *error_string; stats_tree_cfg *cfg = NULL; stats_tree *st = NULL; + const char* filter = NULL; + size_t len; if (abbr) { cfg = stats_tree_get_cfg_by_abbr(abbr); if (cfg != NULL) { - if (strncmp (opt_arg, cfg->pr->init_string, strlen(cfg->pr->init_string)) == 0) { - st = stats_tree_new(cfg, NULL, opt_arg+strlen(cfg->pr->init_string)); + len = strlen(cfg->pr->init_string); + if (strncmp(opt_arg, cfg->pr->init_string, len) == 0) { + if (opt_arg[len] == ',') { + filter = opt_arg + len + 1; + } + st = stats_tree_new(cfg, NULL, filter); } else { report_failure("Wrong stats_tree (%s) found when looking at ->init_string", abbr); return; -- cgit v1.2.3