#!/bin/sh
# $Id: netmaj.in,v 1.16 1996/10/27 15:32:34 suz Exp $
PATH="/usr/pkg/lib/netmaj:/usr/pkg/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin"
export PATH

PORT=""
SKIP="NO"
for i in $*
do
if [ $SKIP = "NO" ] 
then
    case $i in
	-p)
		PORT="-p $2"
		shift
		shift
		SKIP="YES"
		;;
	-a)
		shift
		eval "auto $PORT $* &"
		eval "auto $PORT $* &"
		eval "auto $PORT $* &"
		exit
		;;
	-a1)
		shift
		eval "auto $PORT $* &"
		exit
		;;
	-a2)
		shift
		eval "auto $PORT $* &"
		eval "auto $PORT $* &"
		exit
		;;
	-a3)
		shift
		eval "auto $PORT $* &"
		eval "auto $PORT $* &"
		eval "auto $PORT $* &"
		exit
		;;
	-s)
		shift
		eval "server_kill $PORT"
		exec server $PORT $*
		exit
		;;
	-k)
		shift
		exec server_kill $PORT $*
		exit
		;;
	-1)
		shift
		exec netmaj1 $*
		exit
		;;
	-x)
		shift
		exec xclient -T large $PORT $*
		exit
		;;
	-x1)
		shift
		exec xnetmaj1 -T large $PORT $*
		exit
		;;
#	-sx) # for xui-0.5
#		shift
#		exec sxclient $PORT $*
#		exit
#		;;
#	-sx1) # for xui-0.5
#		shift
#		exec sxnetmaj1 $PORT $*
#		exit
#		;;
	-sx) # for xui-2.0
		shift
		exec xclient -T small $PORT $*
		exit
		;;
	-sx1) # for xui-2.0
		shift
		exec xnetmaj1 -T small $PORT $*
		exit
		;;
	-tx) # for xui-2.0
		shift
		exec xclient -T small4 $PORT $*
		exit
		;;
	-tx1) # for xui-2.0
		shift
		exec xnetmaj1 -T small4 $PORT $*
		exit
		;;
	-ux) # for xui-2.0
		shift
		exec xclient -T large4 $PORT $*
		exit
		;;
	-ux1) # for xui-2.0
		shift
		exec xnetmaj1 -T large4 $PORT $*
		exit
		;;
	-kx)	# for kan netmaj
		shift
		exec knetmajcl $PORT $*
		exit
		;;
	-kx1)	# for kan netmaj
		shift
		exec knetmaj1 $PORT $*
		exit
		;;
	-S)
		shift
		exec player_info $*
		exit
		;;
	-is)
		shift
		exec inputserver $*
		exit
		;;
	-isx)
		shift
		exec kterm -km euc -geometry 40x2 -fg white -bg darkgreen -e inputserver $* &
		exit
		;;
	-isxc)
		shift
		exec kterm -km euc -geometry 40x3 -fg white -bg darkgreen -e canuum -Uu -x inputserver $* &
		exit
		;;
	-ps)
		shift
		exec proxyserver $*
		exit
		;;
	-pc)
		shift
		exec proxyclient $*
		exit
		;;
	-\?)
		echo "usage:"
		echo "    run server:"
		echo "        netmaj [-p port] -s [-H|-Q] [-l logfile]"
		echo "    kill server:"
		echo "        netmaj [-p port] -k"
		echo "    show player info:"
		echo "        netmaj -S [name]"
		echo "    run auto:"
		echo "        netmaj -a[123] [-p port] [-h host_name]"
		echo "    run client:"
		echo "        netmaj [-p port] [-h host_name] [-l logfile]"
		echo "    run client: (X11)"
		echo "        netmaj -x [-p port] [-h host_name] [-l logfile]"
		echo "    run client for one player only: "
		echo "        netmaj -1"
		echo "    run client for one player only: (X11)"
		echo "        netmaj -x1"
		exit
		;;
	*)
		exec client $PORT $*
		exit
		;;
    esac
else
    SKIP="NO"
fi
done

exec client $PORT $*
exit
