#! /bin/sh
# script to start up X version 11 Release 4
# This will only work if you DON'T set your path in the .cshrc. If your
# path/PATH is set in the .cshrc, then make sure /usr/bin/X11 is before
# /usr/local and /usr/new, otherwise nothing will work.
PATH=/usr/bin/X11:$PATH
export PATH
LIB=/usr/lib/X11
if test `tty` != /dev/console; then
    echo "You may only start X11 from a workstation console"
    exit 1
fi
server="/usr/bin/X11/Xsun"
fontpath="/usr/lib/X11/fonts/bdf/misc/,/usr/lib/X11/fonts/bdf/75dpi/,/usr/lib/X11/fonts/bdf/100dpi/"
gotserver=
serveropts=
reverse=
if test $# -gt 0; then
	for i
	do case $i in
		-rv|-r|-reverse)reverse="-rv";
		   shift;;
		-*)if test x$gotserver = x ; then
			echo unknown option: $i
			echo usage: $0 [-rv] [server serveropts]
			exit
		   else
		   	serveropts="$serveropts $i"
		   fi
		   shift;;
		*) if test x$gotserver = x ; then
			server=$i
			gotserver="y"
		   else
		   	serveropts="$serveropts $i"
		   fi
		   shift;;
		esac
	done
fi
if test x$serveropts = x ; then
	serveropts=":0 -a 8 -t 4 -ar1 200 -ar2 20 -zaphod -fp $fontpath"
fi
host=`hostname`
host=`expr "$host" : "\([^\.]*\)\..*"`
# type=`constype`
startup=xstartup.bw2
defaults=Xdefaults.bw2
if test ! -f  $HOME/.$startup
then
	echo First time on this display - copying default $startup
	cp $LIB/$startup $HOME/.$startup
fi
if test ! -x $HOME/.$startup
then
	chmod 755 $HOME/.$startup
fi
if test ! -f $HOME/.$defaults
then
	echo Copying default $defaults
	cp $LIB/$defaults $HOME/.$defaults
fi
if test ! -f $HOME/.twmrc
then
	echo Copying default .twmrc
	cp $LIB/twmrc $HOME/.twmrc
fi
exec xinit $reverse -sb -geometry 92x11+0+0 -T console -name console -C -display unix:0 -e $HOME/.$startup 

