summaryrefslogtreecommitdiff
path: root/minecctl
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-07-12 22:30:22 +0200
committerDavid Härdeman <david@hardeman.nu>2020-07-12 22:30:22 +0200
commitbbdd4abc9f787f057848a5b97656509b877793e0 (patch)
treef1daee6b9302e444ddd17a6d3986a407b35b4806 /minecctl
parent5c91d6294929b86105f16b96de5596a93be3ea68 (diff)
Move more static strings to config.h
Diffstat (limited to 'minecctl')
-rw-r--r--minecctl/misc-commands.c18
-rw-r--r--minecctl/server.c2
2 files changed, 10 insertions, 10 deletions
diff --git a/minecctl/misc-commands.c b/minecctl/misc-commands.c
index 3ad9792..752b0e9 100644
--- a/minecctl/misc-commands.c
+++ b/minecctl/misc-commands.c
@@ -171,7 +171,7 @@ static bool write_server_cfg(struct cfg *cfg, const char *name,
___examples_eula_txt_len))
return false;
- if (!write_cfg_file(sfd, "server.properties",
+ if (!write_cfg_file(sfd, MC_SERVER_PROPERTIES,
properties, properties_len))
return false;
@@ -196,22 +196,22 @@ bool do_init(_unused_ struct cfg *cfg)
if (mcfd < 0)
return false;
- if (!write_cfg_file(mcfd, "minecproxy.conf",
+ if (!write_cfg_file(mcfd, MINECPROXY_CFG_FILE,
___examples_minecproxy_conf,
___examples_minecproxy_conf_len))
return false;
- if (!write_cfg_file(mcfd, "minecctl.conf",
+ if (!write_cfg_file(mcfd, MINECCTL_CFG_FILE,
___examples_minecctl_conf,
___examples_minecctl_conf_len))
return false;
- if (!create_user_service(xcfd, "minecserver@.service",
+ if (!create_user_service(xcfd, SERVER_SYSTEMD_SERVICE,
___examples_minecserver__service,
___examples_minecserver__service_len))
return false;
- if (!create_user_service(xcfd, "minecproxy.service",
+ if (!create_user_service(xcfd, MINECPROXY_SYSTEMD_SERVICE,
___examples_minecproxy_service,
___examples_minecproxy_service_len))
return false;
@@ -309,14 +309,14 @@ static unsigned char *create_mc_server(const char *name, uint16_t local_port,
/* FIXME: Add comments, commented out options */
mcserver = xsprintf(len,
- "[server]\n"
+ "[%s]\n"
"type = proxy\n"
"name = %s\n"
"local = %" PRIu16 "\n"
"idle_timeout = 600\n"
"start_method = systemd\n"
"stop_method = systemd\n",
- name, local_port);
+ SERVER_CONFIG_FILE_HEADER, name, local_port);
if (!mcserver)
error("xsprintf: %m");
@@ -487,8 +487,8 @@ bool do_new(struct cfg *cfg)
if (!valid_name(name))
return false;
- char filename[strlen(name) + STRLEN(".mcserver") + 1];
- sprintf(filename, "%s.mcserver", name);
+ char filename[strlen(name) + STRLEN(".") + STRLEN(SERVER_CONFIG_FILE_SUFFIX) + 1];
+ sprintf(filename, "%s.%s", name, SERVER_CONFIG_FILE_SUFFIX);
if (!server_read_all_configs(cfg, false)) {
error("Failed to read all existing server configurations, "
diff --git a/minecctl/server.c b/minecctl/server.c
index e50e10c..979f85e 100644
--- a/minecctl/server.c
+++ b/minecctl/server.c
@@ -117,7 +117,7 @@ bool server_read_config(struct cfg *cfg, struct server *server,
if (dfd < 0)
goto out;
- if (!read_file(dfd, "server.properties", buf, sizeof(buf),
+ if (!read_file(dfd, MC_SERVER_PROPERTIES, buf, sizeof(buf),
error))
goto out;