#include <stdio.h>
#include <glib.h>
#include <epan/stats_tree_priv.h>
+#include <epan/stat_cmd_args.h>
+#include <epan/report_err.h>
/* actually unused */
struct _st_node_pres {
}
-static void init_stats_tree(const char *optarg) {
+static void init_stats_tree(const char *optarg,void* userdata _U_) {
guint8* abbr = stats_tree_get_abbr(optarg);
GString *error_string;
stats_tree_cfg *cfg = NULL;
if (strncmp (optarg, cfg->pr->init_string, strlen(cfg->pr->init_string)) == 0){
st = stats_tree_new(cfg,NULL,((guint8*)optarg)+strlen(cfg->pr->init_string));
} else {
- st->filter=NULL;
+ report_failure("Wrong stats_tree (%s) found when looking at ->init_string",abbr);
+ return;
}
} else {
- g_error("no such stats_tree (%s) found in stats_tree registry",abbr);
+ report_failure("no such stats_tree (%s) found in stats_tree registry",abbr);
+ return;
}
g_free(abbr);
} else {
- g_error("could not obtain stats_tree abbr (%s) from optarg '%s'",abbr,optarg);
+ report_failure("could not obtain stats_tree abbr (%s) from grg '%s'",abbr,optarg);
+ return;
}
error_string = register_tap_listener( st->cfg->tapname,
draw_stats_tree);
if (error_string) {
- g_error("stats_tree for: %s failed to attach to the tap: %s",cfg->name,error_string->str);
+ report_failure("stats_tree for: %s failed to attach to the tap: %s",cfg->name,error_string->str);
+ return;
}
if (cfg->init) cfg->init(st);
cfg->pr = g_malloc(sizeof(tree_cfg_pres));
cfg->pr->init_string = g_strdup_printf("%s,tree",cfg->abbr);
- register_tap_listener_cmd_arg(cfg->pr->init_string, init_stats_tree);
+ register_stat_cmd_arg(cfg->pr->init_string, init_stats_tree, NULL);
}