summaryrefslogtreecommitdiff
path: root/minecctl/minecctl-rcon.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-26 15:33:47 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-26 15:33:47 +0200
commita6d421f99e90739e60a60232dbe5b09a53545978 (patch)
tree9d0e996171f889952a3a49aa5b5eee1c8345c248 /minecctl/minecctl-rcon.c
parentc3538f5cfbf6a44588f7eb1622f54a6d1468acd8 (diff)
Rename shortname to name...to make it shorter
Diffstat (limited to 'minecctl/minecctl-rcon.c')
-rw-r--r--minecctl/minecctl-rcon.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/minecctl/minecctl-rcon.c b/minecctl/minecctl-rcon.c
index f074f3c..27c586c 100644
--- a/minecctl/minecctl-rcon.c
+++ b/minecctl/minecctl-rcon.c
@@ -112,13 +112,13 @@ rcon_login(struct cfg *cfg, struct server *server)
assert_die(cfg && server, "invalid arguments");
if (list_empty(&server->rcon_addrs)) {
- error("%s: rcon address unknown", server->shortname);
+ error("%s: rcon address unknown", server->name);
goto error;
}
fd = connect_any(&server->rcon_addrs, true);
if (fd < 0) {
- error("%s: unable to connect", server->shortname);
+ error("%s: unable to connect", server->name);
goto error;
}
@@ -126,7 +126,7 @@ rcon_login(struct cfg *cfg, struct server *server)
server->rcon_password = ask_password();
if (!server->rcon_password) {
- error("%s: can't login - password missing", server->shortname);
+ error("%s: can't login - password missing", server->name);
goto error;
}
@@ -140,14 +140,12 @@ rcon_login(struct cfg *cfg, struct server *server)
server->rcon_password = NULL;
if (rtype == RCON_PACKET_LOGIN_OK)
- verbose("%s: login ok", server->shortname);
+ verbose("%s: login ok", server->name);
else if (rtype == RCON_PACKET_LOGIN_FAIL) {
- info("%s: login failure, invalid password?",
- server->shortname);
+ info("%s: login failure, invalid password?", server->name);
goto error;
} else {
- error("%s: invalid return code: %" PRIi32,
- server->shortname, rtype);
+ error("%s: invalid return code: %" PRIi32, server->name, rtype);
goto error;
}
@@ -224,7 +222,7 @@ get_one_status(int fd, char *buf, size_t len, const char *cmd,
va_list ap;
int r;
- send_msg(fd, buf, buflen, RCON_PACKET_COMMAND, cmd, &rtype, reply);
+ send_msg(fd, buf, len, RCON_PACKET_COMMAND, cmd, &rtype, reply);
if (rtype != RCON_PACKET_RESPONSE)
die("Invalid return code: %" PRIi32, rtype);
@@ -358,16 +356,16 @@ stop_one_server(struct cfg *cfg, struct server *server)
if (!get_player_count(fd, &current, NULL)) {
error("%s: unable to get player count, not stopping",
- server->shortname);
+ server->name);
return;
} else if (current > 0) {
error("%s: has active players (use -f to force)",
- server->shortname);
+ server->name);
return;
}
}
- info("%s: sending stop command", server->shortname);
+ info("%s: sending stop command", server->name);
send_cmd(fd, "stop");
close(fd);
}
@@ -421,8 +419,9 @@ do_console(struct cfg *cfg)
return;
prompt = alloca(strlen(program_invocation_short_name) +
- STRLEN(" (") + strlen(server->shortname) + STRLEN("): ") + 1);
- sprintf(prompt, "%s (%s): ", program_invocation_short_name, server->shortname);
+ STRLEN(" (") + strlen(server->name) + STRLEN("): ") + 1);
+ sprintf(prompt, "%s (%s): ", program_invocation_short_name,
+ server->name);
while (true) {
char *tmp;