mirror of
https://github.com/sheumann/hush.git
synced 2025-01-11 08:29:54 +00:00
man: parse "DEFINE pager" in config
function old new delta man_main 789 844 +55 Signed-off-by: John Spencer <maillist-busybox@barfooze.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
731f596175
commit
ff65061311
@ -150,7 +150,7 @@ int man_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
|||||||
int man_main(int argc UNUSED_PARAM, char **argv)
|
int man_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
parser_t *parser;
|
parser_t *parser;
|
||||||
const char *pager;
|
const char *pager = ENABLE_LESS ? "less" : "more";
|
||||||
char **man_path_list;
|
char **man_path_list;
|
||||||
char *sec_list;
|
char *sec_list;
|
||||||
char *cur_path, *cur_sect;
|
char *cur_path, *cur_sect;
|
||||||
@ -171,12 +171,6 @@ int man_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
man_path_list[0] = (char*)"/usr/man";
|
man_path_list[0] = (char*)"/usr/man";
|
||||||
else
|
else
|
||||||
count_mp++;
|
count_mp++;
|
||||||
pager = getenv("MANPAGER");
|
|
||||||
if (!pager) {
|
|
||||||
pager = getenv("PAGER");
|
|
||||||
if (!pager)
|
|
||||||
pager = "more";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parse man.conf[ig] or man_db.conf */
|
/* Parse man.conf[ig] or man_db.conf */
|
||||||
/* man version 1.6f uses man.config */
|
/* man version 1.6f uses man.config */
|
||||||
@ -190,6 +184,11 @@ int man_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
while (config_read(parser, token, 2, 0, "# \t", PARSE_NORMAL)) {
|
while (config_read(parser, token, 2, 0, "# \t", PARSE_NORMAL)) {
|
||||||
if (!token[1])
|
if (!token[1])
|
||||||
continue;
|
continue;
|
||||||
|
if (strcmp("DEFINE", token[0]) == 0) {
|
||||||
|
if (strncmp("pager", token[1], 5) == 0) {
|
||||||
|
pager = xstrdup(skip_whitespace(token[1]) + 5);
|
||||||
|
}
|
||||||
|
} else
|
||||||
if (strcmp("MANDATORY_MANPATH"+10, token[0]) == 0 /* "MANPATH"? */
|
if (strcmp("MANDATORY_MANPATH"+10, token[0]) == 0 /* "MANPATH"? */
|
||||||
|| strcmp("MANDATORY_MANPATH", token[0]) == 0
|
|| strcmp("MANDATORY_MANPATH", token[0]) == 0
|
||||||
) {
|
) {
|
||||||
@ -230,6 +229,15 @@ int man_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
}
|
}
|
||||||
config_close(parser);
|
config_close(parser);
|
||||||
|
|
||||||
|
{
|
||||||
|
/* environment overrides setting from man.config */
|
||||||
|
char *env_pager = getenv("MANPAGER");
|
||||||
|
if (!env_pager)
|
||||||
|
env_pager = getenv("PAGER");
|
||||||
|
if (env_pager)
|
||||||
|
pager = env_pager;
|
||||||
|
}
|
||||||
|
|
||||||
not_found = 0;
|
not_found = 0;
|
||||||
do { /* for each argv[] */
|
do { /* for each argv[] */
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user