From 217bd310b9da9ea39e0ff41473b27b0b2fc1d5e8 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 10 Dec 2019 10:14:07 -0500 Subject: Start implementing configuration --- spm.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'spm.h') diff --git a/spm.h b/spm.h index 24d2835..e7b9d4b 100644 --- a/spm.h +++ b/spm.h @@ -35,13 +35,20 @@ #define SHELL_OUTPUT 1 << 1 #define SHELL_BENCHMARK 1 << 2 +typedef struct { + char *key; + char *value; +} ConfigItem; + typedef struct { char *platform; char *arch; char *package_dir; char *user_config_basedir; char *user_config_file; + ConfigItem **config; } spm_vars; +static spm_vars SPM_GLOBAL; typedef struct { int count; @@ -99,17 +106,13 @@ void check_runtime_environment(void); // config.c #define CONFIG_BUFFER_SIZE 1024 -typedef struct { - char *key; - char *value; -} Config; - char *lstrip(char *sptr); char *strip(char *sptr); int isempty(char *sptr); int isquoted(char *sptr); -Config **config_read(const char *filename); -void config_free(Config **config); +ConfigItem **config_read(const char *filename); +ConfigItem *config_get(ConfigItem **item, const char *key); +void config_free(ConfigItem **item); void config_test(void); #endif //SPM_SPM_H -- cgit