aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/mdocml/APKBUILD39
-rw-r--r--main/mdocml/man.sh52
2 files changed, 91 insertions, 0 deletions
diff --git a/main/mdocml/APKBUILD b/main/mdocml/APKBUILD
new file mode 100644
index 0000000000..c9dc85ac24
--- /dev/null
+++ b/main/mdocml/APKBUILD
@@ -0,0 +1,39 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=mdocml
+pkgver=1.11.4
+pkgrel=0
+pkgdesc="mdoc/man compiler"
+url="http://mdocml.bsd.lv/"
+arch="all"
+license="BSD"
+depends=
+makedepends=
+install=
+subpackages="$pkgname-doc $pkgname-dev $pkgname-man"
+source="http://mdocml.bsd.lv/snapshots/mdocml-$pkgver.tar.gz man.sh"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+ cd "$_builddir"
+}
+
+build() {
+ cd "$_builddir"
+ make PREFIX=/usr || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" PREFIX=/usr MANDIR=/usr/share/man \
+ EXAMPLEDIR=/usr/share/doc/mdocml/examples install
+}
+
+man() {
+ cd "$srcdir"
+ depends="mdocml"
+ install -Dm 755 man.sh "$subpkgdir"/usr/bin/man || return 1
+}
+
+md5sums="ba8af3994706dac47ef904f0b94dc396 mdocml-1.11.4.tar.gz
+d60a6a3ea949f03e7fb90dbe1ca74e1f man.sh"
diff --git a/main/mdocml/man.sh b/main/mdocml/man.sh
new file mode 100644
index 0000000000..6795e2007d
--- /dev/null
+++ b/main/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=