From 29ed9845a482b6eb5b4ced51fef43129be0e2fd3 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 21 Jun 2010 15:26:16 +0200 Subject: [PATCH] "list graphs" action: Limit the number of graphs and instances separately. --- src/action_list_graphs.c | 44 +++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/src/action_list_graphs.c b/src/action_list_graphs.c index 7c8768a..e32b999 100644 --- a/src/action_list_graphs.c +++ b/src/action_list_graphs.c @@ -18,8 +18,12 @@ struct callback_data_s { graph_config_t *cfg; - int limit; - _Bool first; + int graph_index; + int graph_limit; + _Bool graph_more; + int inst_index; + int inst_limit; + _Bool inst_more; }; typedef struct callback_data_s callback_data_t; @@ -33,6 +37,13 @@ static int print_graph_inst_html (graph_config_t *cfg, /* {{{ */ if (data->cfg != cfg) { + data->graph_index++; + if (data->graph_index >= data->graph_limit) + { + data->graph_more = 1; + return (1); + } + if (data->cfg != NULL) printf (" \n"); @@ -44,6 +55,19 @@ static int print_graph_inst_html (graph_config_t *cfg, /* {{{ */ " \n"); + if (cb_data.graph_more) + { + printf ("
  • More ...
  • \n"); + } + printf (" \n"); return (0); -- 2.30.2