#!/bin/sh
machtype=`machtype`
if [ x$XKEYSYMDB = x ]; then
        if [ -r "/mit/x11/${machtype}lib/X11/XKeysymDB" ]; then
                XKEYSYMDB=/afs/athena/astaff/project/x11r5/${machtype}lib/X11/XKeysymDB
                XERRORDB=/afs/athena/astaff/project/x11r5/${machtype}lib/X11/XErrorDB
	        XNLSPATH=/afs/athena/astaff/project/x11r5/${machtype}lib/X11/nls
                export XKEYSYMDB XERRORDB XNLSPATH
        else
		if [ -r "/usr/X11/lib/X11/XKeysymDB" ]; then
	                XKEYSYMDB=/usr/X11/lib/X11/XKeysymDB
			XERRORDB=/usr/X11/lib/X11/XErrorDB
        	        export XKEYSYMDB XERRORDB
		else
	                attach -q -n -h -a -r x11r5 motif1.2    
        	        XKEYSYMDB=/afs/athena/astaff/project/x11r5/${machtype}lib/X11/XKeysymDB
	                XERRORDB=/afs/athena/astaff/project/x11r5/${machtype}lib/X11/XErrorDB
		        XNLSPATH=/afs/athena/astaff/project/x11r5/${machtype}lib/X11/nls
                	export XKEYSYMDB XERRORDB XNLSPATH
	                if [ ! -r ${XKEYSYMDB} ]; then
        	                zwrite ${USER} -n -d -m 'Xcp is unable to find its Motif Keysyms. detach x11; attach x11r5'
                	fi
		fi
	fi
else
	if [ ! -r ${XKEYSYMDB} ]; then
                zwrite ${USER} -n -d -m 'Xcp is unable to find its Motif Keysyms. set your XKEYSYMDB environment variable appropriately'
        fi
fi
XFILESEARCHPATH=${XFILESEARCHPATH-}${XFILESEARCHPATH+:}/afs/sipb/user/yoav/lib/%T/%N
exec /afs/sipb/user/yoav/etc/xcp
