summaryrefslogtreecommitdiff
path: root/minecctl
diff options
context:
space:
mode:
Diffstat (limited to 'minecctl')
-rw-r--r--minecctl/minecctl-rcon.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/minecctl/minecctl-rcon.c b/minecctl/minecctl-rcon.c
index 16939d1..f11a20b 100644
--- a/minecctl/minecctl-rcon.c
+++ b/minecctl/minecctl-rcon.c
@@ -316,14 +316,20 @@ get_player_count(int fd, unsigned *current, unsigned *max)
{
char buf[4096];
const char *reply;
+ unsigned c, m;
- if (get_one_status(fd, buf, sizeof(buf), "list", 2,
- "There are %u of a max %u players online",
- &reply, current, max))
- return true;
-
- else
+ if (!get_one_status(fd, buf, sizeof(buf), "list", 2,
+ "There are %u of a max %u players online",
+ &reply, &c, &m))
return false;
+
+ if (current)
+ *current = c;
+
+ if (max)
+ *max = m;
+
+ return true;
}
static void
@@ -334,10 +340,9 @@ stop_one_server(struct cfg *cfg, struct server *server)
fd = rcon_login(cfg, server);
if (cfg->force_stop) {
- unsigned current, _unused_ max;
+ unsigned current;
- /* FIXME: args optional */
- if (!get_player_count(fd, &current, &max)) {
+ if (!get_player_count(fd, &current, NULL)) {
error("%s: unable to get player count, not stopping",
server->shortname);
return;