diff options
author | Ron Yorston <rmy@pobox.com> | 2014-03-11 19:40:20 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2014-03-11 19:40:20 +0000 |
commit | dec20ad781163656832c571d52d0303c67ea8c09 (patch) | |
tree | 830a27bc8f2383d4ba50680f5d6fac1ec5c96b6a /miscutils | |
parent | 0a2a7b55a9212d8fc708fd564407e5505b5e8363 (diff) | |
parent | 69f9567de28976cfbc7b216c46aa391ce82bd3b7 (diff) | |
download | busybox-w32-dec20ad781163656832c571d52d0303c67ea8c09.tar.gz busybox-w32-dec20ad781163656832c571d52d0303c67ea8c09.tar.bz2 busybox-w32-dec20ad781163656832c571d52d0303c67ea8c09.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/fbsplash.c | 2 | ||||
-rw-r--r-- | miscutils/less.c | 17 | ||||
-rw-r--r-- | miscutils/man.c | 27 |
3 files changed, 30 insertions, 16 deletions
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c index 12a77b70f..7b695b26f 100644 --- a/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c | |||
@@ -353,7 +353,7 @@ static void fb_drawimage(void) | |||
353 | if (LONE_DASH(G.image_filename)) { | 353 | if (LONE_DASH(G.image_filename)) { |
354 | theme_file = stdin; | 354 | theme_file = stdin; |
355 | } else { | 355 | } else { |
356 | int fd = open_zipped(G.image_filename); | 356 | int fd = open_zipped(G.image_filename, /*fail_if_not_compressed:*/ 0); |
357 | if (fd < 0) | 357 | if (fd < 0) |
358 | bb_simple_perror_msg_and_die(G.image_filename); | 358 | bb_simple_perror_msg_and_die(G.image_filename); |
359 | theme_file = xfdopen_for_read(fd); | 359 | theme_file = xfdopen_for_read(fd); |
diff --git a/miscutils/less.c b/miscutils/less.c index 60105f42b..574f222e0 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -98,16 +98,18 @@ | |||
98 | //config: Enables "-N" command. | 98 | //config: Enables "-N" command. |
99 | 99 | ||
100 | //usage:#define less_trivial_usage | 100 | //usage:#define less_trivial_usage |
101 | //usage: "[-E" IF_FEATURE_LESS_FLAGS("Mm") "Nh~I?] [FILE]..." | 101 | //usage: "[-E" IF_FEATURE_LESS_REGEXP("I")IF_FEATURE_LESS_FLAGS("Mm") "Nh~] [FILE]..." |
102 | //usage:#define less_full_usage "\n\n" | 102 | //usage:#define less_full_usage "\n\n" |
103 | //usage: "View FILE (or stdin) one screenful at a time\n" | 103 | //usage: "View FILE (or stdin) one screenful at a time\n" |
104 | //usage: "\n -E Quit once the end of a file is reached" | 104 | //usage: "\n -E Quit once the end of a file is reached" |
105 | //usage: IF_FEATURE_LESS_REGEXP( | ||
106 | //usage: "\n -I Ignore case in all searches" | ||
107 | //usage: ) | ||
105 | //usage: IF_FEATURE_LESS_FLAGS( | 108 | //usage: IF_FEATURE_LESS_FLAGS( |
106 | //usage: "\n -M,-m Display status line with line numbers" | 109 | //usage: "\n -M,-m Display status line with line numbers" |
107 | //usage: "\n and percentage through the file" | 110 | //usage: "\n and percentage through the file" |
108 | //usage: ) | 111 | //usage: ) |
109 | //usage: "\n -N Prefix line number to each line" | 112 | //usage: "\n -N Prefix line number to each line" |
110 | //usage: "\n -I Ignore case in all searches" | ||
111 | //usage: "\n -~ Suppress ~s displayed past EOF" | 113 | //usage: "\n -~ Suppress ~s displayed past EOF" |
112 | 114 | ||
113 | #include <sched.h> /* sched_yield() */ | 115 | #include <sched.h> /* sched_yield() */ |
@@ -1613,10 +1615,13 @@ int less_main(int argc, char **argv) | |||
1613 | 1615 | ||
1614 | INIT_G(); | 1616 | INIT_G(); |
1615 | 1617 | ||
1616 | /* TODO: -x: do not interpret backspace, -xx: tab also */ | 1618 | /* TODO: -x: do not interpret backspace, -xx: tab also |
1617 | /* -xxx: newline also */ | 1619 | * -xxx: newline also |
1618 | /* -w N: assume width N (-xxx -w 32: hex viewer of sorts) */ | 1620 | * -w N: assume width N (-xxx -w 32: hex viewer of sorts) |
1619 | getopt32(argv, "EMmN~I" IF_FEATURE_LESS_DASHCMD("S")); | 1621 | * -s: condense many empty lines to one |
1622 | * (used by some setups for manpage display) | ||
1623 | */ | ||
1624 | getopt32(argv, "EMmN~I" IF_FEATURE_LESS_DASHCMD("S") /*ignored:*/"s"); | ||
1620 | argc -= optind; | 1625 | argc -= optind; |
1621 | argv += optind; | 1626 | argv += optind; |
1622 | num_files = argc; | 1627 | num_files = argc; |
diff --git a/miscutils/man.c b/miscutils/man.c index 429898643..0e0b1cba6 100644 --- a/miscutils/man.c +++ b/miscutils/man.c | |||
@@ -102,11 +102,12 @@ static int run_pipe(const char *pager, char *man_filename, int man, int level) | |||
102 | 102 | ||
103 | ordinary_manpage: | 103 | ordinary_manpage: |
104 | close(STDIN_FILENO); | 104 | close(STDIN_FILENO); |
105 | open_zipped(man_filename); /* guaranteed to use fd 0 (STDIN_FILENO) */ | 105 | open_zipped(man_filename, /*fail_if_not_compressed:*/ 0); /* guaranteed to use fd 0 (STDIN_FILENO) */ |
106 | /* "2>&1" is added so that nroff errors are shown in pager too. | 106 | /* "2>&1" is added so that nroff errors are shown in pager too. |
107 | * Otherwise it may show just empty screen */ | 107 | * Otherwise it may show just empty screen */ |
108 | cmd = xasprintf( | 108 | cmd = xasprintf( |
109 | man ? "gtbl | nroff -Tlatin1 -mandoc 2>&1 | %s" | 109 | /* replaced -Tlatin1 with -Tascii for non-UTF8 displays */ |
110 | man ? "gtbl | nroff -Tascii -mandoc 2>&1 | %s" | ||
110 | : "%s", | 111 | : "%s", |
111 | pager); | 112 | pager); |
112 | system(cmd); | 113 | system(cmd); |
@@ -150,7 +151,7 @@ int man_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | |||
150 | int man_main(int argc UNUSED_PARAM, char **argv) | 151 | int man_main(int argc UNUSED_PARAM, char **argv) |
151 | { | 152 | { |
152 | parser_t *parser; | 153 | parser_t *parser; |
153 | const char *pager; | 154 | const char *pager = ENABLE_LESS ? "less" : "more"; |
154 | char **man_path_list; | 155 | char **man_path_list; |
155 | char *sec_list; | 156 | char *sec_list; |
156 | char *cur_path, *cur_sect; | 157 | char *cur_path, *cur_sect; |
@@ -171,12 +172,6 @@ int man_main(int argc UNUSED_PARAM, char **argv) | |||
171 | man_path_list[0] = (char*)"/usr/man"; | 172 | man_path_list[0] = (char*)"/usr/man"; |
172 | else | 173 | else |
173 | count_mp++; | 174 | count_mp++; |
174 | pager = getenv("MANPAGER"); | ||
175 | if (!pager) { | ||
176 | pager = getenv("PAGER"); | ||
177 | if (!pager) | ||
178 | pager = "more"; | ||
179 | } | ||
180 | 175 | ||
181 | /* Parse man.conf[ig] or man_db.conf */ | 176 | /* Parse man.conf[ig] or man_db.conf */ |
182 | /* man version 1.6f uses man.config */ | 177 | /* man version 1.6f uses man.config */ |
@@ -190,6 +185,11 @@ int man_main(int argc UNUSED_PARAM, char **argv) | |||
190 | while (config_read(parser, token, 2, 0, "# \t", PARSE_NORMAL)) { | 185 | while (config_read(parser, token, 2, 0, "# \t", PARSE_NORMAL)) { |
191 | if (!token[1]) | 186 | if (!token[1]) |
192 | continue; | 187 | continue; |
188 | if (strcmp("DEFINE", token[0]) == 0) { | ||
189 | if (strncmp("pager", token[1], 5) == 0) { | ||
190 | pager = xstrdup(skip_whitespace(token[1]) + 5); | ||
191 | } | ||
192 | } else | ||
193 | if (strcmp("MANDATORY_MANPATH"+10, token[0]) == 0 /* "MANPATH"? */ | 193 | if (strcmp("MANDATORY_MANPATH"+10, token[0]) == 0 /* "MANPATH"? */ |
194 | || strcmp("MANDATORY_MANPATH", token[0]) == 0 | 194 | || strcmp("MANDATORY_MANPATH", token[0]) == 0 |
195 | ) { | 195 | ) { |
@@ -234,6 +234,15 @@ int man_main(int argc UNUSED_PARAM, char **argv) | |||
234 | } | 234 | } |
235 | config_close(parser); | 235 | config_close(parser); |
236 | 236 | ||
237 | { | ||
238 | /* environment overrides setting from man.config */ | ||
239 | char *env_pager = getenv("MANPAGER"); | ||
240 | if (!env_pager) | ||
241 | env_pager = getenv("PAGER"); | ||
242 | if (env_pager) | ||
243 | pager = env_pager; | ||
244 | } | ||
245 | |||
237 | not_found = 0; | 246 | not_found = 0; |
238 | do { /* for each argv[] */ | 247 | do { /* for each argv[] */ |
239 | int found = 0; | 248 | int found = 0; |