Index: usr.bin/man/man.sh =================================================================== --- usr.bin/man/man.sh +++ usr.bin/man/man.sh @@ -269,18 +269,23 @@ fi } -# Usage: man_check_for_so page path +# Usage: man_check_for_so path # Returns: True if able to resolve the file, false if it ended in tears. # Detects the presence of the .so directive and causes the file to be # redirected to another source file. +# +# $manpage will be clobbered with the last found reference upon completion. man_check_for_so() { - local IFS line tstr + local IFS line path tstr unset IFS + if [ -n "$catpage" ]; then return 0 fi + path=$1 + # We need to loop to accommodate multiple .so directives. while true do @@ -472,8 +477,9 @@ decho "Found a usable page, displaying that" unset use_cat manpage="$1" + path=$(dirname $manpage)/.. setup_cattool $manpage - if man_check_for_so $manpage $(dirname $manpage); then + if man_check_for_so $path; then found_page=yes man_display_page fi @@ -492,7 +498,7 @@ # Check if there is a MACHINE specific manpath. if find_file $p $sect $MACHINE "$1"; then - if man_check_for_so $manpage $p; then + if man_check_for_so $p; then found_page=yes man_display_page if [ -n "$aflag" ]; then @@ -506,7 +512,7 @@ # Check if there is a MACHINE_ARCH # specific manpath. if find_file $p $sect $MACHINE_ARCH "$1"; then - if man_check_for_so $manpage $p; then + if man_check_for_so $p; then found_page=yes man_display_page if [ -n "$aflag" ]; then @@ -519,7 +525,7 @@ # Check plain old manpath. if find_file $p $sect '' "$1"; then - if man_check_for_so $manpage $p; then + if man_check_for_so $p; then found_page=yes man_display_page if [ -n "$aflag" ]; then