commit 4462d9db5e2f921341694910c43c870463dff1ee
parent c352a2db98fb49bc1dd001a3f33f45ea581aedb7
Author: Mario Rosell R. Martinez <mario@mariorosell.es>
Date: Fri, 27 Mar 2026 20:10:36 +0100
misc: Add extern to avoid double-definition issues
Diffstat:
4 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/cli.c b/cli.c
@@ -9,6 +9,8 @@
#include "cli.h"
#include "state.h"
+const char* opts = "hvc:";
+
void
cli(int argc, char** argv)
{
@@ -25,7 +27,7 @@ cli(int argc, char** argv)
break;
case 'c':
strncpy(conffile, optarg, sizeof(conffile) - 1);
- optarg[sizeof(conffile) - 1] = '\0'; /* null-terminate */
+ conffile[sizeof(conffile) - 1] = '\0'; /* null-terminate */
break;
/* getopt() handles the rest :) */
diff --git a/cli.h b/cli.h
@@ -2,7 +2,12 @@
* cli.h -- cli() and optstring
*/
-const char* opts = "hvc:";
+#ifndef CLI_H
+#define CLI_H
+
+extern const char* opts;
void cli(int, char**);
+#endif /* CLI_H */
+
diff --git a/state.c b/state.c
@@ -0,0 +1,6 @@
+/*
+ * state.c -- fuck extern
+ */
+
+char conffile[256];
+
diff --git a/state.h b/state.h
@@ -2,6 +2,11 @@
* state.h -- global state
*/
+#ifndef STATE_H
+#define STATE_H
+
/** The configuration file */
-char conffile[512];
+extern char conffile[512];
+
+#endif /* STATE_H */