#! /bin/sh
#
#    Starts up xman with the tools manual pages
#
prefix=/usr/local/mpich
mandir=/usr/local/mpich/man
htmldir=${prefix}/www
#
if [ -n "$MPIDIR" ] ; then 
    mandir="$MPIDIR/man"
    htmldir="$MPIDIR/www"
fi

#
# Start the appropriate program
program="xman -notopbox -helpfile $mandir/mpiman.help"
docdir=man
mankind=UNIX

MANPATH=$mandir
export MANPATH
#
for arg in "$@" ; do
    case $arg in 
	-echo)
	set -x
	;;
	-xmosaic)
	program="xmosaic $htmldir/index.html"
	docdir=$htmldir
	mankind=HTML
	;;
	-mosaic)
	program="mosaic $htmldir/index.html"
	docdir=$htmldir
	mankind=HTML
	;;
	-netscape)
	program="netscape $htmldir/index.html"
	docdir=$htmldir
	mankind=HTML
	;;
	-xman)
	program="xman -notopbox -helpfile $mandir/mpiman.help"
	docdir=$mandir
	MANPATH=$MPIDIR/$docdir
	export MANPATH
	mankind=UNIX
	;;
	-man)
	program=man
	docdir=$mandir
	MANPATH=$mandir
	export MANPATH
	mankind=UNIX
	;;
	*)
	args="$args $arg"
	;;
    esac
done
if [ ! -d $docdir ] ; then
    echo "You do not have $mankind manpages installed"
    exit 1
fi
$program $args

