diff options
Diffstat (limited to 'src/config.c')
| -rw-r--r-- | src/config.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c new file mode 100644 index 0000000..2b05ad6 --- /dev/null +++ b/src/config.c @@ -0,0 +1,28 @@ +#define _GNU_SOURCE + +#include <config.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <util.h> + +void +config_parse(char *content) +{ + char *buffer = strdup(content); + + char *line_internal = strtok(buffer, "\n"); + while (line_internal != NULL) { + char *line = strdup(line_internal); + char *key = strsep(&line, "="); + line = trim(line); + key = trim(key); + + printf("Key: %s\n", key); + printf("Value: %s\n", line); + + line_internal = strtok(NULL, "\n"); + } + + free(buffer); +} |
