#!/sbin/sh
#
# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)IIim	1.1	08/05/06 SMI"
#

case "$1" in
'start')
	is_priv_port=`/usr/sbin/ndd /dev/tcp tcp_extra_priv_ports |
	    /usr/bin/grep -w 9010`
	if [ ! -n "$is_priv_port" ]; then
	   # ndd only works in exclusive stack zone.  Send errors to /dev/null
	   /usr/sbin/ndd -set /dev/tcp tcp_extra_priv_ports_add 9010 \
		>/dev/null 2>&1
	fi
	if [ -x /usr/lib/im/htt ]; then
		/usr/lib/im/htt -port 9010 -syslog -message_locale C \
		    >/dev/null 2>&1 &
	fi
	;;

'stop')
	/usr/bin/pkill -TERM -x -u 0 htt
	;;

*)
	echo "Usage: $0 { start | stop }"
	exit 1
	;;
esac
exit 0
