#!/bin/sh
if [ x"$1" = x"-v" -o x"$1" = x"-V" ]; then
echo "`basename $0` from %version%"
exit 0
fi
BROWSER=${MANHTMLPAGER-lynxcgi}
HOST=${MANHTMLHOST-localhost}
if [ $ BROWSER="$2"
shift; shift
fi
if [ $ HOST="$2"
shift; shift
fi
function nsfunc () {
if ( /bin/ps xc | grep -q 'netscape$' ) ; then
if [ -x netscape-remote ] ; then
exec netscape-remote -remote "openURL($1,new_window)"
else
exec netscape -remote "openURL($1,new_window)"
fi
else
netscape $1 &
fi
}
case $BROWSER in
lynxcgi)
BROWSER=lynx
CG="lynxcgi:/home/httpd/cgi-bin/man"
;;
netscape)
BROWSER=nsfunc
CG="http://$HOST/cgi-bin/man"
;;
*)
CG="http://$HOST/cgi-bin/man"
;;
esac
case $ 0) $BROWSER $CG/man2html ;;
1) case "$1" in
1|2|3|4|5|6|7|8|l|n)
$BROWSER "$CG/mansec?$CG+$1" ;;
/*)
$BROWSER "$CG/man2html?$1" ;;
*/*)
$BROWSER "$CG/man2html?$PWD/$1" ;;
*)
$BROWSER "$CG/man2html?$1" ;;
esac ;;
2) case "$1" in
-k)
$BROWSER "$CG/mansearch?$2" ;;
*)
if [ "$2" = index ]; then
$BROWSER "$CG/manwhatis?$CG+$1"
else
$BROWSER "$CG/man2html?$1+$2"
fi ;;
esac ;;
*) echo "bad number of args" ;;
esac
exit 0