#!/bin/csh
#
# StartXPen
# Command file to start X windows on a liveboard using a pen for input
# based on the StartX script
# Created by Brent Welch, August 28, 1990
#   Willie-Sue, March 30, 1992
#
# You need the files
#   .xinitrc
#   .twmrc
#   .Xdefaults
# in your home directory.
#
# You may edit these three, but be careful not to update them from
# the /project/cedar10.1 versions afterward.  You can use the file
# ~/.xinit-personal for some customization to .xinitrc.

# Running on a liveboard can be tested in .xinitrc or .xinit-personal with
# if [ x"$LIVEBOARD" = x ]; then
#	(not on the liveboard)
# else
#	(on the liveboard)
# fi
# Those scripts are sh (not csh) scripts, so the syntax for if is different...
#
if (`hostname` =~ liveboard*) then
    setenv LIVEBOARD `hostname`
else
    echo "Not on a liveboard host? `hostname`"
    exit 1
endif

# Make sure the search paths contains X windows.  If you add these
# directories in your .login, they won't get set here.
if ( $PATH !~ */import/bin/X11R3* ) set path = ( $path /import/bin/X11R3 )
if ( $PATH !~ */import/X11R4/bin* ) set path = ( /import/X11R4/bin $path )

# Make sure the X11 stuff is on the search path for man.
if ( ! $?MANPATH ) then
    setenv MANPATH /import/X11R4/man:/usr/man
else if ( $MANPATH !~ */import/X11R4/man* ) then
    setenv MANPATH /import/X11R4/man:$MANPATH
endif

# Make sure X11 dynamic link libraries are available.
if ( ! $?LD←LIBRARY←PATH ) then
    setenv LD←LIBRARY←PATH /import/X11R4/usr/lib
else if ( $LD←LIBRARY←PATH !~ */import/X11R4/usr/lib* ) then
    setenv LD←LIBRARY←PATH /import/X11R4/usr/lib:$LD←LIBRARY←PATH
endif

# Use the local display
if (! $?DISPLAY ) setenv DISPLAY "unix:0.0" 

# Make sure the the cleanup part is executed even after errors
onintr cleanup

# Start X server MIT's X11R4, modified to use the pen for input.
# The ar1 and ar2 options are for autorepeat.  They are the
# initial delay in milleseconds to begin autorepeat, and the
# delay between subsequent repeats.
xinit -- /import/liveboard/bin/Xlb -ar1 550 -ar2 40


# Now we are done; clean up.
cleanup:
if (! $?WINDOW←PARENT) then
	reset
	clear
	kbd←mode -a
else
	kbd←mode -a
endif
#
#eof
#