about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-05-03 19:32:55 +0000
committerJune McEnroe <june@causal.agency>2020-05-03 19:43:45 +0000
commit15a24186b08a81cd5cad12460e23f2952575d979 (patch)
tree3eccfaae2e59b993a8f86583bbd3be3625a2f1c9
parentFetch manNN.tgz and compNN.tgz for OpenBSD (diff)
downloadexman-15a24186b08a81cd5cad12460e23f2952575d979.tar.gz
exman-15a24186b08a81cd5cad12460e23f2952575d979.zip
Add exman script
-rw-r--r--.gitignore1
-rw-r--r--Makefile2
-rw-r--r--exman.sh29
3 files changed, 31 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 066e06a..8f9e5a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 *.tar
+exman
 freebsd/
 linux/
 netbsd/
diff --git a/Makefile b/Makefile
index 226657a..5c9b086 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ SYSTEMS += netbsd
 SYSTEMS += openbsd
 SYSTEMS += posix
 
-all: ${SYSTEMS}
+all: exman ${SYSTEMS}
 
 .SUFFIXES: .tar .url
 
diff --git a/exman.sh b/exman.sh
new file mode 100644
index 0000000..f428e30
--- /dev/null
+++ b/exman.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+set -eu
+
+die() {
+	echo "$@" >&2
+	exit 1
+}
+
+script=$0
+path=${script%/*}
+prefix=${path%/bin}
+exman="${prefix}/share/exman"
+[ -d "${exman}" ] || exman=$prefix
+
+system=${1:-}
+[ -n "${system}" ] || die 'What system do you want?'
+shift
+
+export MANPATH="${exman}/${system}"
+[ -d "${MANPATH}" ] || die "No manuals for ${system}"
+
+export MANSECT=
+for sect in "${MANPATH}"/man*/; do
+	sect=${sect%/}
+	sect=${sect##*/man}
+	MANSECT="${MANSECT:-}${MANSECT:+:}${sect}"
+done
+
+exec man "$@"
ghlight'> 2018-08-20Generate scheme.hJune McEnroe 2018-08-20Add dependencies on gfx.hJune McEnroe 2018-08-18Add Blondie — Heart of GlassJune McEnroe Why didn't I know about this song? I love it. 2018-08-18Set FCEDIT=$EDITORJune McEnroe 2018-08-18Only post commits with bodies to MastodonJune McEnroe 2018-08-18Run tf/cfg link script with /bin/shJune McEnroe 2018-08-18Run {,s,t}up with /bin/shJune McEnroe 2018-08-18Use whence instead of typeJune McEnroe type is an alias for whence -v and is more for human consumption. 2018-08-18Cut off path components until right prompt fitsJune McEnroe Keeps paths valid (from somehwere) rather than abrupt truncation. 2018-08-17Add "private" alias to source encrypted fileJune McEnroe Why is there no easy way to *edit* an encrypted file? 2018-08-17Add vim mapping to add a #includeJune McEnroe