projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dc: fix "dc does_not_exist" SEGVing
[oweals/busybox.git]
/
miscutils
/
man.c
diff --git
a/miscutils/man.c
b/miscutils/man.c
index 01382c4d7197ab4b9db84f793c3991a3b33e925f..ba6bb4c01f6df7a2570a37fbab53594cd3e63921 100644
(file)
--- a/
miscutils/man.c
+++ b/
miscutils/man.c
@@
-2,6
+2,15
@@
* Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com>
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
* Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com>
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
+//config:config MAN
+//config: bool "man (27 kb)"
+//config: default y
+//config: help
+//config: Format and display manual pages.
+
+//applet:IF_MAN(APPLET(man, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_MAN) += man.o
//usage:#define man_trivial_usage
//usage: "[-aw] [MANPAGE]..."
//usage:#define man_trivial_usage
//usage: "[-aw] [MANPAGE]..."
@@
-9,6
+18,8
@@
//usage: "Format and display manual page\n"
//usage: "\n -a Display all pages"
//usage: "\n -w Show page locations"
//usage: "Format and display manual page\n"
//usage: "\n -a Display all pages"
//usage: "\n -w Show page locations"
+//usage: "\n"
+//usage: "\n$COLUMNS overrides output width"
#include "libbb.h"
#include "common_bufsiz.h"
#include "libbb.h"
#include "common_bufsiz.h"
@@
-28,6
+39,8
@@
echo ".\\\""
echo ".pl \n(nlu+10"
) | gtbl | nroff -Tlatin1 -mandoc | less
echo ".pl \n(nlu+10"
) | gtbl | nroff -Tlatin1 -mandoc | less
+Some systems use -Tascii.
+
On another system I see this:
... | tbl | nroff -mandoc -rLL=<NNN>n -rLT=<NNN>n -Tutf8 | less
On another system I see this:
... | tbl | nroff -mandoc -rLL=<NNN>n -rLT=<NNN>n -Tutf8 | less
@@
-53,8
+66,8
@@
struct globals {
setup_common_bufsiz(); \
G.col = "col"; \
G.tbl = "tbl"; \
setup_common_bufsiz(); \
G.col = "col"; \
G.tbl = "tbl"; \
- /*
replaced -Tlatin1 with -Tascii for non-UTF8 displays */;
\
- G.nroff = "nroff -mandoc
-Tascii
"; \
+ /*
Removed -Tlatin1. Assuming system nroff has suitable default */
\
+ G.nroff = "nroff -mandoc"; \
G.pager = ENABLE_LESS ? "less" : "more"; \
} while (0)
G.pager = ENABLE_LESS ? "less" : "more"; \
} while (0)
@@
-132,15
+145,12
@@
static int run_pipe(char *man_filename, int man, int level)
close(STDIN_FILENO);
open_zipped(man_filename, /*fail_if_not_compressed:*/ 0); /* guaranteed to use fd 0 (STDIN_FILENO) */
if (man) {
close(STDIN_FILENO);
open_zipped(man_filename, /*fail_if_not_compressed:*/ 0); /* guaranteed to use fd 0 (STDIN_FILENO) */
if (man) {
- /* "man man" formats to screen width.
- * "man man >file" formats to default 80 columns.
- * "man man | cat" formats to default 80 columns.
- */
- int w = get_terminal_width(STDOUT_FILENO);
+ int w = get_terminal_width(-1);
if (w > 10)
w -= 2;
/* "2>&1" is added so that nroff errors are shown in pager too.
if (w > 10)
w -= 2;
/* "2>&1" is added so that nroff errors are shown in pager too.
- * Otherwise it may show just empty screen */
+ * Otherwise it may show just empty screen.
+ */
cmd = xasprintf("%s | %s -rLL=%un -rLT=%un 2>&1 | %s",
G.tbl, G.nroff, w, w,
G.pager);
cmd = xasprintf("%s | %s -rLL=%un -rLT=%un 2>&1 | %s",
G.tbl, G.nroff, w, w,
G.pager);
@@
-243,8
+253,7
@@
int man_main(int argc UNUSED_PARAM, char **argv)
INIT_G();
INIT_G();
- opt_complementary = "-1"; /* at least one argument */
- opt = getopt32(argv, "+aw");
+ opt = getopt32(argv, "^+" "aw" "\0" "-1"/*at least one arg*/);
argv += optind;
sec_list = xstrdup("0p:1:1p:2:3:3p:4:5:6:7:8:9");
argv += optind;
sec_list = xstrdup("0p:1:1p:2:3:3p:4:5:6:7:8:9");