From 1285ba2d13230851c3de0a48482e735a2116de1c Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Mon, 13 Jul 2015 20:51:23 +0200
Subject: degesch: make "/server" alone list all servers
---
degesch.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/degesch.c b/degesch.c
index 7c78681..e0c75ab 100644
--- a/degesch.c
+++ b/degesch.c
@@ -7450,7 +7450,7 @@ handle_command_disconnect (struct handler_args *a)
return true;
}
-static void
+static bool
show_servers_list (struct app_context *ctx)
{
log_global_indent (ctx, "");
@@ -7461,6 +7461,7 @@ show_servers_list (struct app_context *ctx)
struct server *s;
while ((s = str_map_iter_next (&iter)))
log_global_indent (ctx, " #s", s->name);
+ return true;
}
static bool
@@ -7480,10 +7481,13 @@ static bool
handle_command_server (struct handler_args *a)
{
struct app_context *ctx = a->ctx;
+ if (!*a->arguments)
+ return show_servers_list (ctx);
+
char *action = cut_word (&a->arguments);
bool result = true;
if (!strcasecmp_ascii (action, "list"))
- show_servers_list (ctx);
+ result = show_servers_list (ctx);
else if (!strcasecmp_ascii (action, "add"))
result = handle_server_add (a);
else if (!strcasecmp_ascii (action, "remove"))
--
cgit v1.2.3-70-g09d2