X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Faction_list_graphs.c;h=b6fc0394fe439d5e1bd0f9dcfcdf793869f41fc3;hb=4c1798b95e26af39a18a36a3ffdd61d35bd60ea0;hp=b360c1ddbab1400739306b770740e6962c23e708;hpb=2c85f876c1b9d5c161694cfb03cf20773b74c844;p=collection4.git
diff --git a/src/action_list_graphs.c b/src/action_list_graphs.c
index b360c1d..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,24 +100,47 @@ 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");
+ printf ("\n \n");
+ if (term != NULL)
+ printf (" c4: Graphs matching "%s"\n", term);
+ else
+ printf (" c4: List of all graphs\n");
+ printf (" \n \n");
+
+ printf ("
\n",
+ script_name (), (term != NULL) ? term : "");
+
+ printf (" \n");
if (term == NULL)
gl_instance_get_all (print_graph_inst_html, /* user_data = */ &data);
else
gl_search (term, print_graph_inst_html, /* user_data = */ &data);
if (data.cfg != NULL)
- printf ("
\n");
+ printf (" \n");
+
+ printf (" \n");
- printf ("\n");
+ printf (" \n\n");
return (0);
} /* }}} int list_graphs_html */