diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-26 23:14:23 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-26 23:14:23 +0000 |
commit | c24033eebe3b2305c2e8f179e4c55fd6c32b1d13 (patch) | |
tree | 1d4c34ba95a3be7512e04adc5dc7bfe78d94f773 /miscutils/man.c | |
parent | 084266ed520805bbc4ec3f9b4d14e644ecd75880 (diff) | |
download | busybox-w32-c24033eebe3b2305c2e8f179e4c55fd6c32b1d13.tar.gz busybox-w32-c24033eebe3b2305c2e8f179e4c55fd6c32b1d13.tar.bz2 busybox-w32-c24033eebe3b2305c2e8f179e4c55fd6c32b1d13.zip |
man: a forgotten chunk of lask commit (config file parser fixes)
Diffstat (limited to 'miscutils/man.c')
-rw-r--r-- | miscutils/man.c | 36 |
1 files 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) | |||
104 | 104 | ||
105 | /* Parse man.conf */ | 105 | /* Parse man.conf */ |
106 | parser = config_open("/etc/man.conf"); | 106 | parser = config_open("/etc/man.conf"); |
107 | if (parser) { | 107 | while (config_read(parser, token, 2, 0, "# \t", PARSE_NORMAL)) { |
108 | /* go through man configuration file and search relevant paths, sections */ | 108 | if (!token[1]) |
109 | char *token[2]; | 109 | continue; |
110 | while (config_read(parser, token, 2, 0, "# \t", PARSE_LAST_IS_GREEDY)) { | 110 | if (strcmp("MANPATH", token[0]) == 0) { |
111 | if (!token[1]) | 111 | man_path_list = xrealloc_vector(man_path_list, 4, count_mp); |
112 | continue; | 112 | man_path_list[count_mp] = xstrdup(token[1]); |
113 | if (strcmp("MANPATH", token[0]) == 0) { | 113 | count_mp++; |
114 | man_path_list[count_mp] = xstrdup(token[1]); | 114 | /* man_path_list is NULL terminated */ |
115 | count_mp++; | 115 | man_path_list[count_mp] = NULL; |
116 | /* man_path_list is NULL terminated */ | 116 | } |
117 | man_path_list[count_mp] = NULL; | 117 | if (strcmp("MANSECT", token[0]) == 0) { |
118 | man_path_list = xrealloc_vector(man_path_list, 4, count_mp); | 118 | free(sec_list); |
119 | } | 119 | sec_list = xstrdup(token[1]); |
120 | if (strcmp("MANSECT", token[0]) == 0) { | 120 | } |
121 | free(sec_list); | 121 | } |
122 | sec_list = xstrdup(token[1]); | 122 | config_close(parser); |
123 | } | ||
124 | } | ||
125 | config_close(parser); | ||
126 | } | ||
127 | 123 | ||
128 | // TODO: my man3/getpwuid.3.gz contains just one line: | 124 | // TODO: my man3/getpwuid.3.gz contains just one line: |
129 | // .so man3/getpwnam.3 | 125 | // .so man3/getpwnam.3 |