about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-01-08 00:30:21 -0500
committerJune McEnroe <june@causal.agency>2019-01-08 00:30:21 -0500
commit92ee655e2e54a3f5ef4a088c6156998f381a6acf (patch)
tree2512071cd129b92adfc35cc3002a1d1a98c4da84
parentRemove incorrect default coordinates (diff)
downloadtorus-92ee655e2e54a3f5ef4a088c6156998f381a6acf.tar.gz
torus-92ee655e2e54a3f5ef4a088c6156998f381a6acf.zip
Factor out default paths
-rw-r--r--client.c2
-rw-r--r--image.c4
-rw-r--r--server.c4
-rw-r--r--torus.h4
4 files changed, 9 insertions, 5 deletions
diff --git a/client.c b/client.c
index 8f7e901..e2f3596 100644
--- a/client.c
+++ b/client.c
@@ -679,7 +679,7 @@ static void readInput(void) {
 }
 
 int main(int argc, char *argv[]) {
-	const char *sockPath = "torus.sock";
+	const char *sockPath = DefaultSockPath;
 	int opt;
 	while (0 < (opt = getopt(argc, argv, "hs:"))) {
 		switch (opt) {
diff --git a/image.c b/image.c
index 80bb2de..80e2567 100644
--- a/image.c
+++ b/image.c
@@ -256,8 +256,8 @@ next:
 
 int main(int argc, char *argv[]) {
 	bool kcgi = false;
-	const char *fontPath = "default8x16.psfu";
-	const char *dataPath = "torus.dat";
+	const char *fontPath = DefaultFontPath;
+	const char *dataPath = DefaultDataPath;
 	uint32_t tileX = TileInitX;
 	uint32_t tileY = TileInitY;
 
diff --git a/server.c b/server.c
index a2e3578..e635a6c 100644
--- a/server.c
+++ b/server.c
@@ -372,8 +372,8 @@ static bool clientTele(struct Client *client, uint8_t port) {
 int main(int argc, char *argv[]) {
 	int error;
 
-	const char *dataPath = "torus.dat";
-	const char *sockPath = "torus.sock";
+	const char *dataPath = DefaultDataPath;
+	const char *sockPath = DefaultSockPath;
 	const char *pidPath = NULL;
 	int opt;
 	while (0 < (opt = getopt(argc, argv, "d:p:s:"))) {
diff --git a/torus.h b/torus.h
index ba552eb..7326099 100644
--- a/torus.h
+++ b/torus.h
@@ -25,6 +25,10 @@
 
 #define ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0]))
 
+static const char DefaultDataPath[] = "torus.dat";
+static const char DefaultSockPath[] = "torus.sock";
+static const char DefaultFontPath[] = "default8x16.psfu";
+
 enum {
 	ColorBlack,
 	ColorRed,