diff options
-rw-r--r-- | discover/kboot-parser.c | 1 | ||||
-rw-r--r-- | discover/parser-conf.c | 19 | ||||
-rw-r--r-- | discover/parser-conf.h | 1 | ||||
-rw-r--r-- | discover/yaboot-parser.c | 1 |
4 files changed, 20 insertions, 2 deletions
diff --git a/discover/kboot-parser.c b/discover/kboot-parser.c index e688c22..23d48a4 100644 --- a/discover/kboot-parser.c +++ b/discover/kboot-parser.c @@ -137,6 +137,7 @@ static int kboot_parse(struct discover_context *dc) conf->dc = dc; conf->global_options = kboot_global_options, + conf_init_global_options(conf); conf->conf_files = kboot_conf_files, conf->process_pair = kboot_process_pair; conf->parser_info = (void *)kboot_ignored_names, diff --git a/discover/parser-conf.c b/discover/parser-conf.c index 14f847d..88e96b7 100644 --- a/discover/parser-conf.c +++ b/discover/parser-conf.c @@ -121,6 +121,18 @@ int conf_param_in_list(const char *const *list, const char *param) } /** + * conf_init_global_options - Zero the global option table. + */ + +void conf_init_global_options(struct conf_context *conf) +{ + int i; + + for (i = 0; conf->global_options[i].name; i++) + conf->global_options[i].value = NULL; +} + +/** * conf_set_global_option - Set a value in the global option table. * * Check if an option (name=value) is a global option. If so, store it in @@ -136,7 +148,7 @@ int conf_set_global_option(struct conf_context *conf, const char *name, if (streq(name, conf->global_options[i].name)) { conf->global_options[i].value = talloc_strdup(conf, value); - pb_log("%s: %s:%s\n", __func__, name, value); + pb_log("%s: @%s@%s@\n", __func__, name, value); return 1; } } @@ -158,8 +170,11 @@ const char *conf_get_global_option(struct conf_context *conf, int i; for (i = 0; conf->global_options[i].name ;i++) - if (streq(name, conf->global_options[i].name)) + if (streq(name, conf->global_options[i].name)) { + pb_log("%s: @%s@%s@\n", __func__, name, + conf->global_options[i].value); return conf->global_options[i].value; + } assert(0 && "unknown global name"); return NULL; diff --git a/discover/parser-conf.h b/discover/parser-conf.h index 09015d1..3325faf 100644 --- a/discover/parser-conf.h +++ b/discover/parser-conf.h @@ -41,6 +41,7 @@ struct conf_context { int conf_parse(struct conf_context *conf); char *conf_get_param_pair(char *str, char **name_out, char **value_out, char terminator); +void conf_init_global_options(struct conf_context *conf); const char *conf_get_global_option(struct conf_context *conf, const char *name); int conf_set_global_option(struct conf_context *conf, const char *name, diff --git a/discover/yaboot-parser.c b/discover/yaboot-parser.c index d9f2aff..5224bb3 100644 --- a/discover/yaboot-parser.c +++ b/discover/yaboot-parser.c @@ -240,6 +240,7 @@ static int yaboot_parse(struct discover_context *dc) conf->dc = dc; conf->global_options = yaboot_global_options, + conf_init_global_options(conf); conf->conf_files = yaboot_conf_files, conf->process_pair = yaboot_process_pair; conf->finish = yaboot_finish; |