From 39a9e3942cef811f52993c702f1f69b1d28fc7cd Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sun, 6 Jun 2021 13:25:25 -0400 Subject: Added a loop for finding a valid config option. I also added a call to a function that parses the value of the config option. --- config.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config.c b/config.c index f3eabf5..148ad7d 100644 --- a/config.c +++ b/config.c @@ -98,5 +98,14 @@ config *parse_config(const char *filename) { char *line = get_line(&buf); char *value; char *name = strtok_r(line, "=", &value); + const config_opt *opt; + + /* Check to see if the config option name we got is valid. */ + for (opt = config_opts; opt->name != NULL && strcmp(name, opt->name); opt++); + + /* Is the config option valid? */ + if (opt->name != NULL) { + config_val val = parse_option_value(opt, value); + } } } -- cgit v1.2.3-13-gbd6f