diff --git a/CMakeLists.txt b/CMakeLists.txt index 7822b92..e27c4b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,4 +5,9 @@ set(CMAKE_C_STANDARD 23) add_executable(breeze main.c func.c - func.h) + func.h + config/import.c + config/export.c + config/config.c + config/config.h +) diff --git a/config.json b/config.json new file mode 100644 index 0000000..3beeaad --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +{ + "test": "test" +} \ No newline at end of file diff --git a/config/config.c b/config/config.c new file mode 100644 index 0000000..f2767e3 --- /dev/null +++ b/config/config.c @@ -0,0 +1,3 @@ +// +// Created by nano on 4/1/25. +// diff --git a/config/config.h b/config/config.h new file mode 100644 index 0000000..59c0698 --- /dev/null +++ b/config/config.h @@ -0,0 +1,8 @@ +// +// Created by nano on 4/1/25. +// + +#ifndef CONFIG_H +#define CONFIG_H +void loadConfig(char *filepath); +#endif //CONFIG_H diff --git a/config/export.c b/config/export.c new file mode 100644 index 0000000..f2767e3 --- /dev/null +++ b/config/export.c @@ -0,0 +1,3 @@ +// +// Created by nano on 4/1/25. +// diff --git a/config/import.c b/config/import.c new file mode 100644 index 0000000..6370b68 --- /dev/null +++ b/config/import.c @@ -0,0 +1,17 @@ +// +// Created by nano on 4/1/25. +// + +#include +#include + +void loadConfig(char *filepath) { + FILE *fp; + fp = fopen(filepath, "r"); + char configFile[1024]; + while (fgets(configFile, 1024, fp)) { + printf("%s", configFile); + } + fclose(fp); + +} diff --git a/main.c b/main.c index 975e946..8621a7a 100644 --- a/main.c +++ b/main.c @@ -1,7 +1,7 @@ #include #include #include "func.h" - +#include "config/config.h" char *defaultOptions[]={"help","add","run","del","rm"}; @@ -10,33 +10,39 @@ void delCmd(char ** str); void runCmd(char ** str); int main(int argc, char *argv[]) { - //printf("%d \n", argc); if (argc<2) { printHelp(); return 0; } int choice = whichOption(defaultOptions,argv[1]); - printf(argv[1]); - printf("choice is %d \n",choice); switch (choice) { + case 0: + printHelp(); + return 0; case 1: // add addCmd(&argv[2]); + return 0; case 2: // run runCmd(&argv[2]); + return 0; case 3: - case 4: - delCmd(argv[2]); - default: - printf("not yet implemented\\invalid"); + case 4: { + delCmd(&argv[2]); return 0; + } + default: ; } - + loadConfig("config.json"); return 0; } void addCmd(char ** str) { //TODO: implement - printf("adding %s \n", *str); + int i=0; + while (*(str+i)) { + printf("adding %s \n", *(str+i)); + i++; + } } void delCmd(char ** str) { //TODO: implement printf("removed %s \n", *str);