diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /app-text/manpager |
reinit the tree, so we can have metadata
Diffstat (limited to 'app-text/manpager')
-rw-r--r-- | app-text/manpager/Manifest | 4 | ||||
-rw-r--r-- | app-text/manpager/files/manpager.c | 74 | ||||
-rw-r--r-- | app-text/manpager/manpager-1.ebuild | 31 | ||||
-rw-r--r-- | app-text/manpager/metadata.xml | 8 |
4 files changed, 117 insertions, 0 deletions
diff --git a/app-text/manpager/Manifest b/app-text/manpager/Manifest new file mode 100644 index 000000000000..b7656071e445 --- /dev/null +++ b/app-text/manpager/Manifest @@ -0,0 +1,4 @@ +AUX manpager.c 1809 SHA256 bb90bcb9d2efff5db0957b56fdb20bf97ac1aacfe4f71989833dcfa34704c620 SHA512 4f827429dc46993010d0096cb352920dfdcaf2cc97bf10e2155dfea3fda601c011467be65ca3f2e3f5c44cb26de0fd9eb58f7d875f75fd5f1db4b2c6cdabdca2 WHIRLPOOL bb26d082896f41de845fcbe9b5d660b28a14f8afad4f9c266d5fbc04c967858ab72d3b95569cac29e4cd12278ddb6e9589b5fb8d18d157632d6d5adb17e874a8 +EBUILD manpager-1.ebuild 646 SHA256 fa9a4a3ddddf45764b6b37df3d8dafb8b02361782a0562e9656d7574a0decd33 SHA512 7e4582eefc9acfc019b6bf4e9601d3efce10c70bc512af5e806b899bc1d7c9d08b5af4e0ae06d791e110b0a1803b53d1248890ede0f625578b7c2139ab3ad74c WHIRLPOOL d70990c5460ff0fdde63548ba5617208e1c0640a560f5cc12bad73a23c34603c330fd7f18d41e713f78eef554c5e5def183d9d5d0afb1bd90291a26b59dca2c8 +MISC ChangeLog 970 SHA256 476449bcf02927a7044880a4a6760b066e42e9e43d85aa0b7818f4678cac352d SHA512 bda470cedb820caa752f5e40b3ea12ee4dff162591cd443799fdc0df24153c1ead03f5dfefda32a8d22f0b4ac55cb0a8c9d2ebb0c682a500f872956582ee6eee WHIRLPOOL 8db067486f23494239da80bff8a3435caae3eb803f2ebc666103da3e065decd961aebaa2d81384f5bab234d8cfd9a4030e6cd60e222f2a69cf0900c81986e7e1 +MISC metadata.xml 253 SHA256 d82c33ef453113a5c1ebe250dcba373c22934a69b0a86c6ab15a5ca589c25b91 SHA512 54a9069aeb4165d2dff3d473c8001bc51613aac9dff3f7f5e9971a9891a737a31511ffa11cbd523febe581ac1d9de2bdf2f40410f0c4239138f2ccca3ef15555 WHIRLPOOL e5aee23acff864609953a1e4de768f0e4aef704b44c53c021f28573e1ca5c99f1a46d92935ecec2449f7b4419a36d8373127d0ecfa8d7bae72d835e1839eb3f8 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> |