Hi, BusyBox's man is reading both /etc/man.config and $MANPATH to search for man-pages, but currently it assumes $MANPATH contains only a single path.
The MANPATH environment variable may hold a colon-separated list of directories to be searched by man. The same rationale for PATH applies here: packages installed on different prefixes may coexist on the same system. For more information, please see the section "Search Path For Manual Pages" in manpath(1). Signed-off-by: Marcel Rodrigues <[email protected]> --- miscutils/man.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/miscutils/man.c b/miscutils/man.c index 5c1fa2c..8412778 100644 --- a/miscutils/man.c +++ b/miscutils/man.c @@ -153,6 +153,7 @@ int man_main(int argc UNUSED_PARAM, char **argv) parser_t *parser; const char *pager = ENABLE_LESS ? "less" : "more"; char **man_path_list; + char *man_paths; char *sec_list; char *cur_path, *cur_sect; int count_mp, cur_mp; @@ -167,11 +168,15 @@ int man_main(int argc UNUSED_PARAM, char **argv) /* Last valid man_path_list[] is [0x10] */ count_mp = 0; man_path_list = xzalloc(0x11 * sizeof(man_path_list[0])); - man_path_list[0] = getenv("MANPATH"); - if (!man_path_list[0]) /* default, may be overridden by /etc/man.conf */ - man_path_list[0] = (char*)"/usr/man"; - else + man_paths = xstrdup(getenv("MANPATH")); + man_path_list[0] = strtok(man_paths, ":"); + while(man_path_list[count_mp]) { count_mp++; + man_path_list = xrealloc_vector(man_path_list, 4, count_mp); + man_path_list[count_mp] = strtok(NULL, ":"); + } + if (!count_mp) /* default, may be overridden by /etc/man.conf */ + man_path_list[0] = (char*)"/usr/man"; /* Parse man.conf[ig] or man_db.conf */ /* man version 1.6f uses man.config */ @@ -287,6 +292,7 @@ int man_main(int argc UNUSED_PARAM, char **argv) next_arg: argv++; } while (*argv); + free(man_paths); return not_found; } -- 2.1.3
_______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
