about summary refs log tree commit diff
path: root/exman.sh
diff options
context:
space:
mode:
Diffstat (limited to 'exman.sh')
-rw-r--r--exman.sh31
1 files changed, 30 insertions, 1 deletions
diff --git a/exman.sh b/exman.sh
index 5077c34..9b6777d 100644
--- a/exman.sh
+++ b/exman.sh
@@ -26,4 +26,33 @@ for sect in "${MANPATH}"/man*/; do
 	MANSECT="${MANSECT:-}${MANSECT:+:}${sect}"
 done
 
-exec man "$@"
+# macOS man(1) refuses to search in directories such as "man3p", so do it
+# manually here unless there are other flags passed.
+hack() {
+	case "${1:-}" in
+		(-*) exec man "$@";;
+		([0-9]*) MANSECT=$1; shift;;
+	esac
+	[ $# -gt 0 ] || die 'What manual page do you want?'
+	for page in "$@"; do
+		found=0
+		IFS=:
+		for sect in $MANSECT; do
+			path="${MANPATH}/man${sect}/${page}"
+			for ext in ".${sect}" ".${sect}.gz"; do
+				[ -f "${path}${ext}" ] || continue
+				man "${path}${ext}"
+				found=1
+				break
+			done
+			[ $found -eq 0 ] || break
+		done
+		[ $found -ne 0 ] || die "No manual entry for ${page}"
+	done
+}
+
+if [ "$(uname)" = 'Darwin' ]; then
+	hack "$@"
+else
+	exec man "$@"
+fi
/td>June McEnroe 2019-09-23Add Trail of LightningJune McEnroe 2019-09-22Revert "Enable cookies in title"June McEnroe 2019-09-20Enable cookies in titleJune McEnroe 2019-09-16Use sensitivity aliases in TF2June McEnroe 2019-09-16Add The Just CityJune McEnroe 2019-09-12Only GET the final redirect locationJune McEnroe 2019-09-12Consume entire bodyJune McEnroe 2019-09-10Add title -v flagJune McEnroe 2019-09-10Use curl error bufferJune McEnroe 2019-09-10Set Accept-Encoding in titleJune McEnroe 2019-09-08Set title User-AgentJune McEnroe 2019-09-07Add -x flag to titleJune McEnroe 2019-09-07Ignore SIGPIPE in relayJune McEnroe 2019-09-07Add A Memory Called EmpireJune McEnroe 2019-09-05Handle lack of Content-TypeJune McEnroe 2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe