aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/config.c11
-rw-r--r--src/util.c4
2 files changed, 9 insertions, 6 deletions
diff --git a/src/config.c b/src/config.c
index 9724677..43aa2b6 100644
--- a/src/config.c
+++ b/src/config.c
@@ -20,19 +20,20 @@ config_parse(char *content)
char *key = trim(strsep(&buffer, DELIM));
while (buffer != NULL) {
- char *value = NULL;
buffer = ltrim(buffer);
+ list_add(keys, strdup(key));
+
if (*buffer == '{') {
buffer++;
- value = trim(strsep(&buffer, "}"));
- remove_spaces(value);
+ list_add(values, "\0");
+
+ char *raw_array = remove_spaces(trim(strsep(&buffer, "}")));
} else {
- value = trim(strsep(&buffer, "\n"));
+ char *value = trim(strsep(&buffer, "\n"));
}
printf("KEY %s\n", key);
- printf("VALUE %s\n", value);
key = trim(strsep(&buffer, DELIM));
}
diff --git a/src/util.c b/src/util.c
index efb85ce..ebae1e6 100644
--- a/src/util.c
+++ b/src/util.c
@@ -26,7 +26,7 @@ trim(char *s)
return rtrim(ltrim(s));
}
-void
+char *
remove_spaces(char *str)
{
int count = 0;
@@ -35,4 +35,6 @@ remove_spaces(char *str)
if (!isspace(str[i]))
str[count++] = str[i];
str[count] = '\0';
+
+ return str;
}