Package: busybox
Version: v1.25.1
Severity: wishlist

The attached patch lets the user configure the command used to format man pages 
by busybox's man.
I'm using heirloom-doctools instead of groff in a toy distro, which doesn't 
provide gtbl (just tbl) and doesn't work with -Tascii (I use -Tutf8 instead), 
so I am using this to let me view man pages.
I think that it would also be useful if busybox was built without seamless 
decompression - the command could pipe the man page through gunzip before 
sending it on.

I've tested this by building with the defaults, with a changed command, and 
without man.

Regards,
Alastair Hughes
From 5732986c3312617d899719a56744a7609490042e Mon Sep 17 00:00:00 2001
From: Alastair Hughes <[email protected]>
Date: Fri, 28 Oct 2016 16:56:29 +1300
Subject: [PATCH] man: let the user specify the format command

Let the user configure the command used by man to format man pages. Not
all systems provide gtbl, for instance, and if man is built without
seamless decompression compressed man pages should be piped through an
external gunzip.

Signed-off-by: Alastair Hughes <[email protected]>
---
 miscutils/Config.src | 7 +++++++
 miscutils/Kbuild.src | 1 +
 miscutils/man.c      | 3 +--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/miscutils/Config.src b/miscutils/Config.src
index 06f1c52..c4fb6b4 100644
--- a/miscutils/Config.src
+++ b/miscutils/Config.src
@@ -413,6 +413,13 @@ config MAN
 	help
 	  Format and display manual pages.
 
+config MAN_FORMAT
+	string "Format command for man"
+	default "gtbl | nroff -Tascii -mandoc 2>&1"
+	depends on MAN
+	help
+	  Decompressed man pages are piped to this command and then to a pager.
+
 config MICROCOM
 	bool "microcom"
 	default y
diff --git a/miscutils/Kbuild.src b/miscutils/Kbuild.src
index 503f549..92ecbb2 100644
--- a/miscutils/Kbuild.src
+++ b/miscutils/Kbuild.src
@@ -35,6 +35,7 @@ endif
 lib-$(CONFIG_LESS)        += less.o
 lib-$(CONFIG_MAKEDEVS)    += makedevs.o
 lib-$(CONFIG_MAN)         += man.o
+ccflags-$(CONFIG_MAN)     += "\"$(CONFIG_MAN_FORMAT)\""
 lib-$(CONFIG_MICROCOM)    += microcom.o
 lib-$(CONFIG_MOUNTPOINT)  += mountpoint.o
 lib-$(CONFIG_MT)          += mt.o
diff --git a/miscutils/man.c b/miscutils/man.c
index f705dd3..c44ef3f 100644
--- a/miscutils/man.c
+++ b/miscutils/man.c
@@ -107,8 +107,7 @@ static int run_pipe(const char *pager, char *man_filename, int man, int level)
 	 * Otherwise it may show just empty screen */
 	cmd = xasprintf(
 		/* replaced -Tlatin1 with -Tascii for non-UTF8 displays */
-		man ? "gtbl | nroff -Tascii -mandoc 2>&1 | %s"
-		    : "%s",
+		man ? CONFIG_MAN_FORMAT " | %s" : "%s",
 		pager);
 	system(cmd);
 	free(cmd);
-- 
2.10.1

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to