aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/config.c b/config.c
index 1235a6b..bc9eed6 100644
--- a/config.c
+++ b/config.c
@@ -28,7 +28,7 @@
#include <errno.h>
unsigned short port = 0;
-char *tmpl_path = NULL;
+char *tmpl_path = NULL, *root = NULL;
int
config_load(const char *conf_path)
@@ -71,6 +71,10 @@ config_load(const char *conf_path)
value[strlen(value) - 1] = '\0';
tmpl_path = strdup(value);
printf("\ttemplate: %s\n", tmpl_path);
+ } else if (strcmp(line, "root") == 0) {
+ value[strlen(value) - 1] = '\0';
+ root = strdup(value);
+ printf("\troot: %s\n", root);
} else {
fprintf(stderr, "[config] unknown key: %s\n", line);
continue;
@@ -89,6 +93,11 @@ config_load(const char *conf_path)
tmpl_path = DEFAULT_TMPL_PATH;
}
+ if (!root) {
+ fprintf(stderr, "[config] E: no root given\n");
+ return -1;
+ }
+
return 0;
}