diff options
Diffstat (limited to 'minecctl/minecctl.c')
-rw-r--r-- | minecctl/minecctl.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/minecctl/minecctl.c b/minecctl/minecctl.c index c00a994..95e3e35 100644 --- a/minecctl/minecctl.c +++ b/minecctl/minecctl.c @@ -166,7 +166,7 @@ error: return false; } -static void +static bool do_list(struct cfg *cfg) { struct server *server; @@ -175,6 +175,8 @@ do_list(struct cfg *cfg) list_for_each_entry(server, &cfg->servers, list) if (server->filename) info("%s", server->name); + + return true; } static inline void @@ -378,8 +380,7 @@ main(int argc, char **argv) struct cfg cfg = { .servers = LIST_HEAD_INIT(cfg.servers), }; - struct server *server, *tmp; - int rv = EXIT_FAILURE; + bool success = false; debug_mask = DBG_ERROR | DBG_INFO; @@ -402,18 +403,14 @@ main(int argc, char **argv) dump_config(&cfg); - /* FIXME: Should return bool */ - cfg.cmd(&cfg); - - rv = EXIT_SUCCESS; + success = cfg.cmd(&cfg); out: - list_for_each_entry_safe(server, tmp, &cfg.servers, list) - server_free(server); + server_free_all(&cfg); free_password(&cfg.rcon_password); xfree(cfg.rcon_addrstr); xfree(cfg.mc_addrstr); xfree(cfg.cmdstr); - exit(rv); + exit(success ? EXIT_SUCCESS : EXIT_FAILURE); } |