summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-26 23:20:43 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-26 23:20:43 +0200
commita87e894ba3f3a8915389f651fb034f0d1835630c (patch)
tree70ca77275f6c79dc869c3bd1808d35e2239c0ced
parent957634c7c434b6c8d696ca8f4098e96a201fdfb0 (diff)
Split misc commands into a separate file
-rw-r--r--minecctl/meson.build3
-rw-r--r--minecctl/minecctl.c16
-rw-r--r--minecctl/misc-commands.c18
-rw-r--r--minecctl/misc-commands.h7
-rw-r--r--minecctl/rcon-commands.c (renamed from minecctl/minecctl-rcon.c)2
-rw-r--r--minecctl/rcon-commands.h (renamed from minecctl/minecctl-rcon.h)4
6 files changed, 32 insertions, 18 deletions
diff --git a/minecctl/meson.build b/minecctl/meson.build
index a3a0813..e3bddcc 100644
--- a/minecctl/meson.build
+++ b/minecctl/meson.build
@@ -1,7 +1,8 @@
minecctl_sources = [
'minecctl.c',
- 'minecctl-rcon.c',
'server.c',
+ 'rcon-commands.c',
+ 'misc-commands.c',
'misc.c',
]
diff --git a/minecctl/minecctl.c b/minecctl/minecctl.c
index 95e3e35..b93f87b 100644
--- a/minecctl/minecctl.c
+++ b/minecctl/minecctl.c
@@ -15,8 +15,9 @@
#include "utils.h"
#include "minecctl.h"
#include "minecctl-commands.h"
-#include "minecctl-rcon.h"
#include "server.h"
+#include "rcon-commands.h"
+#include "misc-commands.h"
#include "misc.h"
#include "config-parser.h"
#include "config.h"
@@ -166,19 +167,6 @@ error:
return false;
}
-static bool
-do_list(struct cfg *cfg)
-{
- struct server *server;
-
- /* server->filename check excludes servers created from cmdline */
- list_for_each_entry(server, &cfg->servers, list)
- if (server->filename)
- info("%s", server->name);
-
- return true;
-}
-
static inline void
get_optional_server_arg(struct cfg *cfg, char * const **argv, bool more)
{
diff --git a/minecctl/misc-commands.c b/minecctl/misc-commands.c
new file mode 100644
index 0000000..6b70c55
--- /dev/null
+++ b/minecctl/misc-commands.c
@@ -0,0 +1,18 @@
+#include "utils.h"
+#include "minecctl.h"
+#include "server.h"
+#include "misc-commands.h"
+
+bool
+do_list(struct cfg *cfg)
+{
+ struct server *server;
+
+ /* server->filename check excludes servers created from cmdline */
+ list_for_each_entry(server, &cfg->servers, list)
+ if (server->filename)
+ info("%s", server->name);
+
+ return true;
+}
+
diff --git a/minecctl/misc-commands.h b/minecctl/misc-commands.h
new file mode 100644
index 0000000..e0dc675
--- /dev/null
+++ b/minecctl/misc-commands.h
@@ -0,0 +1,7 @@
+#ifndef foomisccommandshfoo
+#define foomisccommandshfoo
+
+bool do_list(struct cfg *cfg);
+
+#endif
+
diff --git a/minecctl/minecctl-rcon.c b/minecctl/rcon-commands.c
index c387b38..02b970f 100644
--- a/minecctl/minecctl-rcon.c
+++ b/minecctl/rcon-commands.c
@@ -11,7 +11,7 @@
#include "utils.h"
#include "minecctl.h"
-#include "minecctl-rcon.h"
+#include "rcon-commands.h"
#include "server.h"
#include "rcon-protocol.h"
#include "misc.h"
diff --git a/minecctl/minecctl-rcon.h b/minecctl/rcon-commands.h
index 348845f..5366bf9 100644
--- a/minecctl/minecctl-rcon.h
+++ b/minecctl/rcon-commands.h
@@ -1,5 +1,5 @@
-#ifndef foominecctlrconhfoo
-#define foominecctlrconhfoo
+#ifndef foorconcommandshfoo
+#define foorconcommandshfoo
bool do_status(struct cfg *cfg);