diff --git a/config.c b/config.c
deleted file mode 100644
index 0576d58..0000000
--- a/config.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2026 Joshua Vega
- *
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-#include "config.h"
-
-int getConfig(int argc, char** argv, Config* config)
-{
- /* TODO */
- return 0;
-}
diff --git a/config.h b/config.h
deleted file mode 100644
index e3d54b6..0000000
--- a/config.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2026 Joshua Vega
- *
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-#ifndef CONFIG_H
-#define CONFIG_H
-
-typedef struct {
-} Config;
-
-int getConfig(const int, char**, Config*);
-
-#endif /* CONFIG_H */
diff --git a/main.c b/main.c
index 27f1cdd..0517951 100644
--- a/main.c
+++ b/main.c
@@ -13,18 +13,67 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-#include "config.h"
+#include
#include
+#include
+#include
-Config globalConfig;
+#define ARG_L_CONFIG_PATH "--config"
+#define ARG_S_CONFIG_PATH "-c"
+
+#define ARG_LEN_L_CONFIG_PATH 8
+#define ARG_LEN_S_CONFIG_PATH 2
+
+char configPath[1024];
+size_t configPathLength = 0;
+
+int parseArguments(int, char**);
+void printHelp(void);
int main(int argc, char** argv)
{
- int result = getConfig(argc, argv, &globalConfig);
- if (result != 0) {
- return -1;
+ if (parseArguments(argc, argv) != 0) {
+ printHelp();
+ return 0;
}
- printf("Hello world!\n");
return 0;
}
+
+int parseArguments(int argc, char** argv)
+{
+ bool expectConfigPath = false;
+
+ for (int argIndex = 1; argIndex < argc; argIndex++) {
+ const char* arg = argv[argIndex];
+
+ if (expectConfigPath) {
+ size_t length = strlen(arg);
+ if (length > 1024) {
+ return 1;
+ }
+
+ memcpy(configPath, arg, length);
+ configPath[length] = '\0';
+ configPathLength = length + 1;
+
+ printf("Loading config %s\n", configPath);
+ expectConfigPath = false;
+ continue;
+ }
+
+ if (!expectConfigPath && (strncmp(arg, ARG_L_CONFIG_PATH, ARG_LEN_L_CONFIG_PATH) || strncmp(arg, ARG_S_CONFIG_PATH, ARG_LEN_S_CONFIG_PATH))) {
+ printf("Encountered config path argument.\n");
+ expectConfigPath = true;
+ } else {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+void printHelp(void)
+{
+ /* TODO */
+}