From 97f299a09ad5bb7a27f5d27afb9f90a5ffd1e218 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 28 Jul 2010 16:51:21 +0200 Subject: [PATCH] "list graphs" action: List only configured graphs by default. --- src/action_list_graphs.c | 10 +++++++++- src/graph_list.c | 7 +++++-- src/graph_list.h | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/action_list_graphs.c b/src/action_list_graphs.c index 1984cd5..f59da7c 100644 --- a/src/action_list_graphs.c +++ b/src/action_list_graphs.c @@ -76,8 +76,16 @@ static int print_one_graph (graph_config_t *cfg, /* {{{ */ static int print_all_graphs (__attribute__((unused)) void *user_data) /* {{{ */ { + const char *dynamic; + _Bool include_dynamic = 0; + + dynamic = param ("dynamic"); + if ((dynamic != NULL) + && (strcmp ("true", dynamic) == 0)) + include_dynamic = 1; + printf (" \n"); return (0); diff --git a/src/graph_list.c b/src/graph_list.c index b405476..60cb82a 100644 --- a/src/graph_list.c +++ b/src/graph_list.c @@ -780,8 +780,8 @@ int gl_config_submit (void) /* {{{ */ return (0); } /* }}} int graph_config_submit */ -int gl_graph_get_all (graph_callback_t callback, /* {{{ */ - void *user_data) +int gl_graph_get_all (_Bool include_dynamic, /* {{{ */ + graph_callback_t callback, void *user_data) { size_t i; @@ -799,6 +799,9 @@ int gl_graph_get_all (graph_callback_t callback, /* {{{ */ return (status); } + if (!include_dynamic) + return (0); + for (i = 0; i < gl_dynamic_num; i++) { int status; diff --git a/src/graph_list.h b/src/graph_list.h index f7cb40e..43d4406 100644 --- a/src/graph_list.h +++ b/src/graph_list.h @@ -37,7 +37,8 @@ int gl_config_submit (void); graph_config_t *gl_graph_get_selected (void); -int gl_graph_get_all (graph_callback_t callback, void *user_data); +int gl_graph_get_all (_Bool include_dynamic, + graph_callback_t callback, void *user_data); int gl_graph_instance_get_all (graph_config_t *cfg, graph_inst_callback_t callback, void *user_data); -- 2.11.0