#!/bin/sh

prefix=/usr
exec_prefix=/usr
monodocdir=/usr/lib/monodoc

if test `basename $0` = mod; then
	if test x$1 = x; then
	    echo Usage is: mod TOPIC
	    exit 1;
	fi
fi

case x$1 in
    x--assemble)
	shift;
	exec mono $monodocdir/assembler.exe "$@"
	;;
    x--get-sourcesdir)
	echo $monodocdir/sources
	exit 0
	;;
    x--normalize)
	shift;
	exec mono $monodocdir/normalize.exe "$@"
	;;
	x--update)
	shift;
	exec mono $monodocdir/updater.exe "$@"
	;;
    x--help)
	echo "Usage is:"
	echo "monodoc [options]"
	echo ""
	echo "where [options] is one of the following:"
	echo "  --assemble		runs the doc assembler"
	echo "  --update		runs the doc updater"
	echo "  --help		print this message"
	echo "  --html TOPIC		print the html contents of TOPIC"
	echo "  --get-sourcesdir	print the location of monodoc sources"
	echo "  --make-index		create the index"
	echo "  --merge-changes CHANGE_FILE [TARGET_DIR]"
	echo "  --normalize		format a documentation file consistently"
	echo "  TOPIC			display the browser at TOPIC (ex. N:System)"
	exit 0
	;;
esac

export MONO_MANAGED_XSLT=true

cd $monodocdir
if test `basename $0` = mod; then
    mono --debug mod.exe $1 | lynx -dump -stdin -force_html | ${PAGER:-more}
    exit
fi

exec mono --debug browser.exe $OPTIONS "$@" $REST
