From c24033eebe3b2305c2e8f179e4c55fd6c32b1d13 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 26 Jul 2008 23:14:23 +0000 Subject: [PATCH] man: a forgotten chunk of lask commit (config file parser fixes) --- miscutils/man.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/miscutils/man.c b/miscutils/man.c index adb85b81c..5c8e2a4e5 100644 --- a/miscutils/man.c +++ b/miscutils/man.c @@ -104,26 +104,22 @@ int man_main(int argc UNUSED_PARAM, char **argv) /* Parse man.conf */ parser = config_open("/etc/man.conf"); - if (parser) { - /* go through man configuration file and search relevant paths, sections */ - char *token[2]; - while (config_read(parser, token, 2, 0, "# \t", PARSE_LAST_IS_GREEDY)) { - if (!token[1]) - continue; - if (strcmp("MANPATH", token[0]) == 0) { - man_path_list[count_mp] = xstrdup(token[1]); - count_mp++; - /* man_path_list is NULL terminated */ - man_path_list[count_mp] = NULL; - man_path_list = xrealloc_vector(man_path_list, 4, count_mp); - } - if (strcmp("MANSECT", token[0]) == 0) { - free(sec_list); - sec_list = xstrdup(token[1]); - } - } - config_close(parser); - } + while (config_read(parser, token, 2, 0, "# \t", PARSE_NORMAL)) { + if (!token[1]) + continue; + if (strcmp("MANPATH", token[0]) == 0) { + man_path_list = xrealloc_vector(man_path_list, 4, count_mp); + man_path_list[count_mp] = xstrdup(token[1]); + count_mp++; + /* man_path_list is NULL terminated */ + man_path_list[count_mp] = NULL; + } + if (strcmp("MANSECT", token[0]) == 0) { + free(sec_list); + sec_list = xstrdup(token[1]); + } + } + config_close(parser); // TODO: my man3/getpwuid.3.gz contains just one line: // .so man3/getpwnam.3