X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmain.c;h=470d67d2b22074bc9439e00667351683eed879f7;hb=5c578b1f4b9bb7b2c892b18daf1d43ef489d0ebb;hp=496754f8f73e129a5d1e9cad8b3a1fba235783a6;hpb=748436c71114d396ded0d2187355aced2275f6c4;p=collection4.git diff --git a/src/main.c b/src/main.c index 496754f..470d67d 100644 --- a/src/main.c +++ b/src/main.c @@ -38,6 +38,7 @@ #include "action_graph.h" #include "action_list_graphs.h" +#include "action_list_hosts.h" #include "action_search.h" #include "action_search_json.h" #include "action_show_graph.h" @@ -62,6 +63,7 @@ static const action_t actions[] = { { "graph", action_graph }, { "list_graphs", action_list_graphs }, + { "list_hosts", action_list_hosts }, { "search", action_search }, { "search_json", action_search_json }, { "show_graph", action_show_graph }, @@ -105,14 +107,25 @@ static int handle_request (void) /* {{{ */ else { size_t i; + int status = ENOENT; + + gl_update (/* request_served = */ 0); for (i = 0; i < actions_num; i++) { if (strcmp (action, actions[i].name) == 0) - return ((*actions[i].callback) ()); + { + status = (*actions[i].callback) (); + break; + } } - return (action_usage ()); + if (i >= actions_num) + status = action_usage (); + + gl_update (/* request_served = */ 1); + + return (status); } } /* }}} int handle_request */