summaryrefslogtreecommitdiff
path: root/minecctl
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-26 00:47:12 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-26 00:47:12 +0200
commitc9575bb333c036e5470d0ff872169cdb4626e023 (patch)
treea64a72eb1bcdfe8e51e02ad22b913cbdc879f055 /minecctl
parent0993c40ec87095c0a1e29b48ba03bdadc1fdb102 (diff)
Some more cleanups
Diffstat (limited to 'minecctl')
-rw-r--r--minecctl/minecctl.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/minecctl/minecctl.c b/minecctl/minecctl.c
index 969b04d..7c01736 100644
--- a/minecctl/minecctl.c
+++ b/minecctl/minecctl.c
@@ -306,15 +306,9 @@ strv_join(char * const *strv)
static void
get_known_servers()
{
- static bool first = true;
struct dirent *dent;
DIR *dir;
- if (!first)
- return;
-
- first = false;
-
dir = opendir(cfg->cfgdir);
if (!dir) {
info("Can't open config directory %s: %m", cfg->cfgdir);
@@ -366,7 +360,7 @@ set_server(const char *name)
}
}
- error("%s is not a known server", name);
+ error("\"%s\" is not a known server or command", name);
usage(false);
}
@@ -436,14 +430,12 @@ connect_any(struct list_head *addrs, bool may_fail)
break;
}
- if (!connected) {
- if (may_fail)
- return -1;
- else
- die("Failed to connect to remote host");
- }
-
- return sfd;
+ if (!connected && may_fail)
+ return -1;
+ else if (!connected)
+ die("Failed to connect to remote host");
+ else
+ return sfd;
}
static inline void
@@ -656,11 +648,9 @@ main(int argc, char **argv)
parse_command(&argv[optind]);
if (!cfg->cmd)
- die("Command not parsed correctly");
+ die("Failed to parse command");
if (cfg->server) {
- info("Would read file %s", cfg->server->filename);
-
read_server_config();
} else if (cfg->addrstr) {