summaryrefslogtreecommitdiff
path: root/app-text/manpager
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-text/manpager
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-text/manpager')
-rw-r--r--app-text/manpager/Manifest3
-rw-r--r--app-text/manpager/files/manpager.c74
-rw-r--r--app-text/manpager/manpager-1.ebuild31
-rw-r--r--app-text/manpager/metadata.xml8
4 files changed, 116 insertions, 0 deletions
diff --git a/app-text/manpager/Manifest b/app-text/manpager/Manifest
new file mode 100644
index 000000000000..703828218c64
--- /dev/null
+++ b/app-text/manpager/Manifest
@@ -0,0 +1,3 @@
+AUX manpager.c 1809 BLAKE2B 3f17501b90ca4af07e2bdebdc02b0dfd9aafe4dafe878852deeba30219593b1dc4310bd4a152ebf8bc4a58df61cf40fd3fe341cf0fd69e9cccfa43568a7ec67e SHA512 4f827429dc46993010d0096cb352920dfdcaf2cc97bf10e2155dfea3fda601c011467be65ca3f2e3f5c44cb26de0fd9eb58f7d875f75fd5f1db4b2c6cdabdca2
+EBUILD manpager-1.ebuild 646 BLAKE2B bfb4bd847f6a94f6db1cf5b7536ce4984ac82c8feb12cecdec09a01196a93fd95512717a262532721e2095bff5d043889dcffbb7c47f75495b3920386a4e9e6e SHA512 7e4582eefc9acfc019b6bf4e9601d3efce10c70bc512af5e806b899bc1d7c9d08b5af4e0ae06d791e110b0a1803b53d1248890ede0f625578b7c2139ab3ad74c
+MISC metadata.xml 253 BLAKE2B 295e9d6d93aaa12af413972e1590c67087801cc09c9aa6b59d4606c0f4106d1dacf2baa9858559083b4c6d91beeef218d0729e8593a33788958da6d2897e8ce2 SHA512 54a9069aeb4165d2dff3d473c8001bc51613aac9dff3f7f5e9971a9891a737a31511ffa11cbd523febe581ac1d9de2bdf2f40410f0c4239138f2ccca3ef15555
diff --git a/app-text/manpager/files/manpager.c b/app-text/manpager/files/manpager.c
new file mode 100644
index 000000000000..99b0680a1d83
--- /dev/null
+++ b/app-text/manpager/files/manpager.c
@@ -0,0 +1,74 @@
+/*
+ * Wrapper to help enable colorized man page output.
+ * Only works with PAGER=less
+ *
+ * https://bugs.gentoo.org/184604
+ * https://unix.stackexchange.com/questions/108699/documentation-on-less-termcap-variables
+ *
+ * Copyright 2003-2015 Gentoo Foundation
+ * Distributed under the terms of the GNU General Public License v2
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define COLOR(c, b) "\e[" #c ";" #b "m"
+
+#define _SE(termcap, col) setenv("LESS_TERMCAP_" #termcap, col, 0)
+#define SE(termcap, c, b) _SE(termcap, COLOR(c, b))
+
+static int usage(void)
+{
+ puts(
+ "manpager: display man pages with color!\n"
+ "\n"
+ "Usage:\n"
+ "\texport MANPAGER=manpager\n"
+ "\tman man\n"
+ "\n"
+ "To control the colorization, set these env vars:\n"
+ "\tLESS_TERMCAP_mb - start blinking\n"
+ "\tLESS_TERMCAP_md - start bolding\n"
+ "\tLESS_TERMCAP_me - stop bolding\n"
+ "\tLESS_TERMCAP_us - start underlining\n"
+ "\tLESS_TERMCAP_ue - stop underlining\n"
+ "\tLESS_TERMCAP_so - start standout (reverse video)\n"
+ "\tLESS_TERMCAP_se - stop standout (reverse video)\n"
+ "\n"
+ "You can do so by doing:\n"
+ "\texport LESS_TERMCAP_md=\"$(printf '\\e[1;36m')\"\n"
+ "\n"
+ "Run 'less --help' or 'man less' for more info"
+ );
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+ if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
+ return usage();
+
+ /* Blinking. */
+ SE(mb, 5, 31); /* Start. */
+
+ /* Bolding. */
+ SE(md, 1, 34); /* Start. */
+ SE(me, 0, 0); /* Stop. */
+
+ /* Underlining. */
+ SE(us, 4, 36); /* Start. */
+ SE(ue, 0, 0); /* Stop. */
+
+#if 0
+ /* Standout (reverse video). */
+ SE(so, 1, 32); /* Start. */
+ SE(se, 0, 0); /* Stop. */
+#endif
+
+ argv[0] = getenv("PAGER") ? : "less";
+ execvp(argv[0], argv);
+ perror("could not launch PAGER");
+ return 1;
+}
diff --git a/app-text/manpager/manpager-1.ebuild b/app-text/manpager/manpager-1.ebuild
new file mode 100644
index 000000000000..39b1214d8e0d
--- /dev/null
+++ b/app-text/manpager/manpager-1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit toolchain-funcs
+
+DESCRIPTION="Enable colorization of man pages"
+HOMEPAGE="https://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~arm-linux ~x86-linux"
+IUSE=""
+
+S=${WORKDIR}
+
+src_compile() {
+ local cmd=(
+ $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
+ "${FILESDIR}"/manpager.c -o ${PN}
+ )
+ echo "${cmd[@]}"
+ "${cmd[@]}" || die
+}
+
+src_install() {
+ dobin ${PN}
+ insinto /etc/env.d
+ echo "MANPAGER=manpager" | newins - 00manpager
+}
diff --git a/app-text/manpager/metadata.xml b/app-text/manpager/metadata.xml
new file mode 100644
index 000000000000..56c124413057
--- /dev/null
+++ b/app-text/manpager/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>base-system@gentoo.org</email>
+ <name>Gentoo Base System</name>
+</maintainer>
+</pkgmetadata>