1
0

more changes

This commit is contained in:
dtb
2023-08-17 17:51:47 -04:00
parent 4f7d204f5a
commit aa110975ae
3 changed files with 13 additions and 21 deletions

View File

@@ -5,33 +5,29 @@ set -e
str isvalue "$MANUAL_DIR" \
|| MANUAL_DIR=/usr/manual
argv0="$0"
# normalization
! str isvalue "$1" || str isvalue "$3" \
&& printf "Usage: %s [name] (section)\n" "$argv0" 1>&2 \
&& exit 1 \
|| true
|| \
str isvalue "$2" && ! test -e "$MANUAL_DIR/$2/$1" \
&& printf "%s: %s: No manual entry in section %s\n" "$0" "$1" "$2" \
1>&2 \
&& exit 1 \
|| true
|| \
str isvalue "$2" \
&& PAGE="$MANUAL_DIR/$2/$1" \
|| for d in "$MANUAL_DIR"/*
do test -e "$d/$1" && PAGE="$d/$1"
done
# lookup + execution
! str isvalue "$PAGE" \
&& printf "%s: %s: No manual entry\n" "$0" "$1" 1>&2 \
&& exit 1 \
|| true
|| \
! str isvalue "$SECTION_DIR" \
&& printf "%s: %s: No manual entry\n" "$argv0" "$1" 1>&2 \
&& exit 1 \
|| true
|| \
<"$PAGE" groff -t -e -mandoc -Tascii