man: a forgotten chunk of lask commit (config file parser fixes)

This commit is contained in:
Denis Vlasenko 2008-07-26 23:14:23 +00:00
parent 084266ed52
commit c24033eebe

View File

@ -104,18 +104,15 @@ int man_main(int argc UNUSED_PARAM, char **argv)
/* Parse man.conf */ /* Parse man.conf */
parser = config_open("/etc/man.conf"); parser = config_open("/etc/man.conf");
if (parser) { while (config_read(parser, token, 2, 0, "# \t", PARSE_NORMAL)) {
/* 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]) if (!token[1])
continue; continue;
if (strcmp("MANPATH", token[0]) == 0) { 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]); man_path_list[count_mp] = xstrdup(token[1]);
count_mp++; count_mp++;
/* man_path_list is NULL terminated */ /* man_path_list is NULL terminated */
man_path_list[count_mp] = NULL; man_path_list[count_mp] = NULL;
man_path_list = xrealloc_vector(man_path_list, 4, count_mp);
} }
if (strcmp("MANSECT", token[0]) == 0) { if (strcmp("MANSECT", token[0]) == 0) {
free(sec_list); free(sec_list);
@ -123,7 +120,6 @@ int man_main(int argc UNUSED_PARAM, char **argv)
} }
} }
config_close(parser); config_close(parser);
}
// TODO: my man3/getpwuid.3.gz contains just one line: // TODO: my man3/getpwuid.3.gz contains just one line:
// .so man3/getpwnam.3 // .so man3/getpwnam.3