diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-09-14 21:26:55 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-09-14 21:26:55 +0000 |
commit | e357d2ae6833e3ca306f3aa6e12c6ddf2ff1eae2 (patch) | |
tree | 6d7eeb35abf5a1f915a89e7fa5ac35fd84c78960 /miscutils | |
parent | 7c9c1bb61655d5d15a14dd7080e5bda0df43ef75 (diff) | |
download | busybox-w32-e357d2ae6833e3ca306f3aa6e12c6ddf2ff1eae2.tar.gz busybox-w32-e357d2ae6833e3ca306f3aa6e12c6ddf2ff1eae2.tar.bz2 busybox-w32-e357d2ae6833e3ca306f3aa6e12c6ddf2ff1eae2.zip |
man: use default MANPATH of "/usr/man"; do not search paths twice
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/man.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/miscutils/man.c b/miscutils/man.c index e6824ebc8..26fd44ddf 100644 --- a/miscutils/man.c +++ b/miscutils/man.c | |||
@@ -169,10 +169,10 @@ int man_main(int argc UNUSED_PARAM, char **argv) | |||
169 | sec_list = xstrdup("1:2:3:4:5:6:7:8:9"); | 169 | sec_list = xstrdup("1:2:3:4:5:6:7:8:9"); |
170 | /* Last valid man_path_list[] is [0x10] */ | 170 | /* Last valid man_path_list[] is [0x10] */ |
171 | man_path_list = xzalloc(0x11 * sizeof(man_path_list[0])); | 171 | man_path_list = xzalloc(0x11 * sizeof(man_path_list[0])); |
172 | count_mp = 0; | 172 | man_path_list[0] = getenv("MANPATH"); |
173 | man_path_list[0] = xstrdup(getenv("MANPATH")); | 173 | if (!man_path_list[0]) |
174 | if (man_path_list[0]) | 174 | man_path_list[0] = (char*)"/usr/man"; |
175 | count_mp++; | 175 | count_mp = 1; |
176 | pager = getenv("MANPAGER"); | 176 | pager = getenv("MANPAGER"); |
177 | if (!pager) { | 177 | if (!pager) { |
178 | pager = getenv("PAGER"); | 178 | pager = getenv("PAGER"); |
@@ -186,6 +186,13 @@ int man_main(int argc UNUSED_PARAM, char **argv) | |||
186 | if (!token[1]) | 186 | if (!token[1]) |
187 | continue; | 187 | continue; |
188 | if (strcmp("MANPATH", token[0]) == 0) { | 188 | if (strcmp("MANPATH", token[0]) == 0) { |
189 | /* Do we already have it? */ | ||
190 | char **path_element = man_path_list; | ||
191 | while (*path_element) { | ||
192 | if (strcmp(*path_element, token[1]) == 0) | ||
193 | goto skip; | ||
194 | path_element++; | ||
195 | } | ||
189 | man_path_list = xrealloc_vector(man_path_list, 4, count_mp); | 196 | man_path_list = xrealloc_vector(man_path_list, 4, count_mp); |
190 | man_path_list[count_mp] = xstrdup(token[1]); | 197 | man_path_list[count_mp] = xstrdup(token[1]); |
191 | count_mp++; | 198 | count_mp++; |
@@ -196,6 +203,7 @@ int man_main(int argc UNUSED_PARAM, char **argv) | |||
196 | free(sec_list); | 203 | free(sec_list); |
197 | sec_list = xstrdup(token[1]); | 204 | sec_list = xstrdup(token[1]); |
198 | } | 205 | } |
206 | skip: ; | ||
199 | } | 207 | } |
200 | config_close(parser); | 208 | config_close(parser); |
201 | 209 | ||