From: Florian Forster Date: Sat, 19 Jun 2010 08:19:15 +0000 (+0200) Subject: src/action_list_graphs.c: Implement a limit of instances returned. X-Git-Tag: v4.0.0~232 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4c1798b95e26af39a18a36a3ffdd61d35bd60ea0;p=collection4.git src/action_list_graphs.c: Implement a limit of instances returned. --- diff --git a/src/action_list_graphs.c b/src/action_list_graphs.c index cb2e31d..b6fc039 100644 --- a/src/action_list_graphs.c +++ b/src/action_list_graphs.c @@ -66,6 +66,7 @@ static int list_graphs_json (void) /* {{{ */ struct callback_data_s { graph_config_t *cfg; + int limit; }; typedef struct callback_data_s callback_data_t; @@ -99,12 +100,19 @@ static int print_graph_inst_html (graph_config_t *cfg, /* {{{ */ printf ("
  • %s
  • \n", script_name (), params, desc); + if (data->limit > 0) + data->limit--; + + /* Abort scan if limit is reached. */ + if (data->limit == 0) + return (1); + return (0); } /* }}} int print_graph_inst_html */ static int list_graphs_html (const char *term) /* {{{ */ { - callback_data_t data = { NULL }; + callback_data_t data = { NULL, /* limit = */ 20 }; printf ("Content-Type: text/html\n\n"); printf ("\n \n");