aboutsummaryrefslogtreecommitdiffstats
path: root/testing/mdocml
diff options
context:
space:
mode:
authorPaul Onyschuk <blink@bojary.koba.pl>2011-06-21 14:34:30 +0200
committerPaul Onyschuk <blink@bojary.koba.pl>2011-06-21 14:55:15 +0200
commite45438a84c61e3708edda1d861fc1836c74a14fd (patch)
tree538b10c3b29510db8980b5f34cbc2223d1ce22f7 /testing/mdocml
parent9dbf1a40ebbfdb044dedabc77e99c15f127e7c01 (diff)
downloadaports-e45438a84c61e3708edda1d861fc1836c74a14fd.tar.bz2
aports-e45438a84c61e3708edda1d861fc1836c74a14fd.tar.xz
testing/mdocml: add man subpackage
Diffstat (limited to 'testing/mdocml')
-rw-r--r--testing/mdocml/APKBUILD13
-rw-r--r--testing/mdocml/man.sh52
2 files changed, 62 insertions, 3 deletions
diff --git a/testing/mdocml/APKBUILD b/testing/mdocml/APKBUILD
index 384881fccc..07241e7799 100644
--- a/testing/mdocml/APKBUILD
+++ b/testing/mdocml/APKBUILD
@@ -9,8 +9,8 @@ license="BSD"
depends=
makedepends=
install=
-subpackages="$pkgname-doc $pkgname-dev"
-source="http://mdocml.bsd.lv/snapshots/mdocml-$pkgver.tar.gz"
+subpackages="$pkgname-doc $pkgname-dev $pkgname-man"
+source="http://mdocml.bsd.lv/snapshots/mdocml-$pkgver.tar.gz man.sh"
_builddir="$srcdir"/$pkgname-$pkgver
@@ -29,4 +29,11 @@ package() {
EXAMPLEDIR=/usr/share/doc/mdocml/examples install
}
-md5sums="497b4278acb96a087ee6f92c64b4a56d mdocml-1.11.3.tar.gz"
+man() {
+ cd "$srcdir"
+ depends="mdocml"
+ install -Dm 755 man.sh "$subpkgdir"/usr/bin/man || return 1
+}
+
+md5sums="497b4278acb96a087ee6f92c64b4a56d mdocml-1.11.3.tar.gz
+d60a6a3ea949f03e7fb90dbe1ca74e1f man.sh"
diff --git a/testing/mdocml/man.sh b/testing/mdocml/man.sh
new file mode 100644
index 0000000000..6795e2007d
--- /dev/null
+++ b/testing/mdocml/man.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# man - a simple man program for ASCII pages
+# Copyright (c) 2008 Matthew Hiles
+#
+# Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+
+## requires: find, head, sort, tr, cat, and grep/egrep
+## optional: zcat, bzcat, less
+
+if [ -z "$MANPATH" ]; then
+ echo "Warning: MANPATH is not set, assuming /usr/share/man." >&2
+ MANPATH=/usr/share/man
+fi
+
+case $# in
+1)
+ pagearg=$1 ;;
+2)
+ section=man$1
+ pagearg=$2 ;;
+*)
+ echo "Usage: man [section] <manpage>"
+ exit
+esac
+
+paths=`echo "$MANPATH" | tr ":" " "`
+pagefile=`find $paths | grep "/$section" | grep "/$pagearg\." | sort | head -n1`
+
+if [ -z "$pagefile" ]; then
+ echo -n No manual entry for $pagearg
+ [ $section ] && echo -n " in section $1 of the manual."
+ echo
+ exit
+fi
+
+[ "$PAGER" ] || PAGER=less
+tty -s <&1 || PAGER=cat
+
+case "$pagefile" in
+*.bz2)
+ exec bzcat "$pagefile" | "$PAGER" ;;
+*.gz)
+ exec zcat "$pagefile" | "$PAGER" ;;
+*)
+ exec mandoc -Tutf8 "$pagefile" | "$PAGER" ;;
+esac
+
+paths=
+pagefile=
+pagearg=
+section=