summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-26 13:02:57 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-26 13:02:57 +0200
commitb72059e22db619adfbd41087ed662c1c79845565 (patch)
tree3a3633e4428f7d25d16cf09c62c6735afe30f81c
parenta5aecede9626611c8fc375a7976ed69079e706ee (diff)
Improve config dumping in minecctl
-rw-r--r--minecctl/minecctl.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/minecctl/minecctl.c b/minecctl/minecctl.c
index bbe605b..bdf51c1 100644
--- a/minecctl/minecctl.c
+++ b/minecctl/minecctl.c
@@ -26,15 +26,32 @@ static struct cfg *cfg = NULL;
static void
dump_config()
{
- info("Configuration:");
+ /* FIXME: return unless debugging enabled */
+ struct server *server;
+ struct saddr *saddr;
+
+ info("Configuration");
+ info("=============");
info("password : %s", cfg->password);
info("cfgdir : %s", cfg->cfgdir);
info("addrstr : %s", cfg->addrstr);
info("cmdstr : %s", cfg->cmdstr);
info("cmd : %p", cfg->cmd);
info("force stop : %s", cfg->force_stop ? "yes" : "no");
- info("servers : %sempty", list_empty(&cfg->servers) ? "" : "not ");
- /* FIXME: dump servers */
+
+ list_for_each_entry(server, &cfg->servers, list) {
+ info(" * server");
+ info(" shortname : %s", server->shortname);
+ info(" filename : %s", server->filename);
+ info(" rcon_password : %s", server->rcon_password);
+ info(" file_read : %s", server->file_read ? "yes" : "no");
+ list_for_each_entry(saddr, &server->rcon_addrs, list)
+ info(" * rcon addr : %s", saddr->addrstr);
+ list_for_each_entry(saddr, &server->mc_addrs, list)
+ info(" * mc addr : %s", saddr->addrstr);
+ }
+
+ info("=============");
}
void
@@ -418,8 +435,6 @@ parse_command(char * const *argv)
default:
die("Unreachable");
}
-
- dump_config();
}
static void
@@ -437,6 +452,8 @@ parse_cmdline(int argc, char * const *argv)
cfg->cfgdir = DEFAULT_CFG_DIR;
+ /* FIXME: add lint and debug options */
+
while (true) {
int option_index = 0;
static struct option long_options[] = {
@@ -528,6 +545,7 @@ main(int argc, char **argv)
if (cfg->addrstr || cfg->mcaddrstr)
if (!create_server_from_cmdline_args())
goto out;
+ dump_config();
/* FIXME: Should return bool */
cfg->cmd(cfg);