:
#	@(#) haltsys.sh 23.1 91/08/29 
#
#	Copyright (C) 1988-1991 The Santa Cruz Operation, Inc.
#		All Rights Reserved.
#	The information in this file is provided for the exclusive use of
#	the licensees of The Santa Cruz Operation, Inc.  Such users have the
#	right to use, modify, and incorporate this code into other products
#	for purposes authorized by the license agreement provided they include
#	this notice and the associated copyright notice with any such product.
#	The information in this file is provided "AS IS" without warranty.
#

# Begin SCO_BASE

# shell script front end to uadmin to stop the system
PATH=/bin:/usr/bin:/etc

# parse command line : /etc/haltsys(reboot) or haltsys(reboot)
arg=$0
cmd=`expr "$arg" : ".*/\(.*\)"`
[ $cmd ] || cmd=$arg

cd /
sync
sync
umountall 2> /dev/null

case $cmd in
haltsys*)
	case $1 in
	-d)	# stay down with no reboot option
		uadmin 2 3 ;;
	"")	# stay down until a key is stroke
		uadmin 2 0 ;;
	*)	
		echo "Usage : /etc/haltsys [-d]\n        /etc/reboot" ;;
	esac
	;;
reboot*)	# shutdown and reboot
	uadmin 2 2
	;;
*)
	echo "Usage : /etc/haltsys [-d]\n        /etc/reboot"
	;;
esac

# End SCO_BASE
