#!/bin/sh
# $XFree86: xc/programs/Xserver/hw/xfree86/etc/XdmConf.svr4,v 3.3 1996/12/23 06:47:05 dawes Exp $
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 06/05/1994 05:08 UTC by root@gamma
# Source directory /home5/x/XdmConf.svr4
#
# $XConsortium: XdmConf.svr4 /main/3 1996/02/21 17:47:15 kaleb $
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   2194 -rw-r--r-- README
#   1598 -rwxr-xr-x XFilePaths
#   2762 -rwxr-xr-x Xdm
#     29 -rwxr-xr-x Xreset_0
#    994 -rw-r--r-- Xresources
#    430 -rw-r--r-- Xservers
#   1075 -rwxr-xr-x Xsession
#     91 -rwxr-xr-x Xsetup_0
#     29 -rwxr-xr-x Xstartup_0
#   2029 -rw-r--r-- profile
#    960 -rw-r--r-- xdm-config
#   2861 -rwxr-xr-x xsession
#
# ============= README ==============
if test -f 'README' -a X"$1" != X"-c"; then
	echo 'x - skipping README (File already exists)'
else
echo 'x - extracting README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'README' &&
Sample xdm configuration files for XFree86 3.1 / SVR4
-----------------------------------------------------
X
X
File		Install Path		Comments
------------------------------------------------
XXdm		/etc/init.d	  	See the comments at the top for
X   					info on links you need to set up.  
X					Heed the note about using the "vtXX" 
X					option when starting the server in 
X					xdm's Xservers file (which is done 
X					in the sample).
X
XXFilePaths	/usr/X11R6/lib/X11	Sets up $XFILESEARCHPATH and
X					$XUSERFILESEARCHPATH, for Xt.  This
X					is sourced by Xsession for xdm and
X					by .profile for startx.
X
XXresources	/usr/X11R6/lib/X11/xdm	Basically the same as the distributed
X					one.  The greeting is a little more
X					friendly :->
X
XXservers	/usr/X11R6/lib/X11/xdm	Specifies the local server.  Note
X					the 'vt06' option.  Specify whichever
X					Virtual Terminal you want XFree86 to
X					use.
X
XXsession	/usr/X11R6/lib/X11/xdm	Does a much better job of setting up
X					the environment than the distributed
X					one.  See the comments in the file.
X				
XXsetup_0	/usr/X11R6/lib/X11/xdm	Use this to start up an xconsole, and
X					anything else you want on the screen
X					with the login prompt (e.g. a clock).
X
XXstartup_0	/usr/X11R6/lib/X11/xdm	Use this to put an entry in the utmp
X					file corresponding to the xdm session.
X					
XXreset_0	/usr/X11R6/lib/X11/xdm	Use this to remove the utmp entry
X					added by Xstartup_0
X
xdm-config	/usr/X11R6/lib/X11/xdm	Sets up paths better suited to having
X					a vendor X package installed in
X					addition to XFree86.  Also gets the
X					server permissions right so xconsole
X					can start up.
X
profile		${HOME}/.profile	A sample profile that coordinates well
X					with Xsession and .xsession/.xinitrc
X					See the comments in the file.
X
xsession	${HOME}/.session	Also link it to ${HOME}/.xinitrc
X					See the comments in the file.  It's
X					set up to let you use one startup file
X					for both startx and xdm.
X
Version 1.0 - 6/12/92
X   David E. Wexelblat <dwex@goblin.org>, <dwex@aib.com>
X
Version 1.1 - 6/24/92
X   Add XFilePaths
X
Version 1.2 - 7/13/92
X   Add Xstartup_0, Xreset_0, change xdm-config
X
Version 1.3 - 6/5/94
X   Update for X11R6/XFree86 3.1
SHAR_EOF
chmod 0644 README ||
echo 'restore of README failed'
Wc_c="`wc -c < 'README'`"
test 2194 -eq "$Wc_c" ||
	echo 'README: original size 2194, current size' "$Wc_c"
fi
# ============= XFilePaths ==============
if test -f 'XFilePaths' -a X"$1" != X"-c"; then
	echo 'x - skipping XFilePaths (File already exists)'
else
echo 'x - extracting XFilePaths (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'XFilePaths' &&
#
# XFilePaths - set up default X search paths and user search paths.
#   This file should be sourced rather than executed.
#
# Version 1.1 - 6/5/94
#   David E. Wexelblat <dwex@goblin.org>
#
XXFILESEARCHPATH=/usr/X11R6/lib/X11/%L/%T/%N%C%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X11R6/lib/X11/%L/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X11R6/lib/X11/%l/%T/%N%C%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X11R6/lib/X11/%l/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X11R6/lib/X11/%T/%N%C%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X11R6/lib/X11/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X386/lib/X11/%L/%T/%N%C%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X386/lib/X11/%L/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X386/lib/X11/%l/%T/%N%C%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X386/lib/X11/%l/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X386/lib/X11/%T/%N%C%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/X386/lib/X11/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/lib/X11/%L/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/lib/X11/%l/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/lib/X11/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/lib/X11/locale/%L/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/lib/X11/locale/%l/%T/%N%S
XXFILESEARCHPATH=${XFILESEARCHPATH}:/usr/lib/X11/locale/%T/%N%S
export XFILESEARCHPATH
X
XXUSERFILESEARCHPATH=${HOME}/lib/app-defaults/%N%C
XXUSERFILESEARCHPATH=${XUSERFILESEARCHPATH}:${HOME}/lib/app-defaults/%N
XXUSERFILESEARCHPATH=${XUSERFILESEARCHPATH}:${HOME}/%N%C
XXUSERFILESEARCHPATH=${XUSERFILESEARCHPATH}:${HOME}/%N
export XUSERFILESEARCHPATH
SHAR_EOF
chmod 0755 XFilePaths ||
echo 'restore of XFilePaths failed'
Wc_c="`wc -c < 'XFilePaths'`"
test 1598 -eq "$Wc_c" ||
	echo 'XFilePaths: original size 1598, current size' "$Wc_c"
fi
# ============= Xdm ==============
if test -f 'Xdm' -a X"$1" != X"-c"; then
	echo 'x - skipping Xdm (File already exists)'
else
echo 'x - extracting Xdm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Xdm' &&
#
# Xdm - startup script for xdm under SVR4
#
# Install this file as /etc/init.d/Xdm. Create the following links to 
# cause xdm to be started & stopped when booting and shutting down:
#
#	ln /etc/init.d/Xdm /etc/rc0.d/K88xdm
#	ln /etc/init.d/Xdm /etc/rc2.d/S90xdm
#
# WARNING:
#   If you are using the xqueue driver in your Xconfig file, you must
#   specify the 'vtXX' option to the server in your Xservers file.  See
#   the XFree86(1) and xdm(1) manual pages.
#
# Version 1.0 - 6/12/92
#   David E. Wexelblat <dwex@goblin.org>
#
# Version 1.1 - 7/15/92
#   Read /etc/default/login, set ulimit, TZ, HZ
#
# Version 1.2 - 6/5/94
#   Update for X11R6
#
X
#
# Root of the X tree
#
XXPATH=/usr/X11R6
X
case $1 in
'start')
X	#
X	# First nuke an old streams pipe that may have been left lying
X	# around.
X	#
X	rm -f /dev/X/server.0
X
X	#
X	# Verify that xdm was previously shut down cleanly.  This will avoid
X	# a loop if xdm caused a crash.
X	#
X	if [ -f ${XPATH}/lib/X11/xdm/.badexit ]
X	then
X		echo "Not starting xdm - abnormal exit"
X		exit 1
X	fi
X
X	#
X	# If the xdm binary exists...
X	#
X	if [ -x ${XPATH}/bin/xdm ]
X	then
X		#
X		# Create a pseudo-lock file, so that if the system crashes
X		# xdm won't start up on the next boot (safer when debugging
X		# X servers or xdm)
X		#
X		touch ${XPATH}/lib/X11/xdm/.badexit
X		#
X		# Read /etc/default/login to set some parameters
X		#
X		DEF_LOGIN=/etc/default/login
X		if [ -r $DEF_LOGIN ]; then
X			line=`grep '^TIMEZONE=' $DEF_LOGIN`
X			if [ "$line" ]; then
X				TZ=`expr $line : 'TIMEZONE=\(.*\)'`
X				export TZ
X			fi
X			line=`grep '^HZ=' $DEF_LOGIN`
X			if [ "$line" ]; then
X				HZ=`expr "$line" : 'HZ=\(.*\)'`
X				export HZ
X			fi
X			line=`grep '^ULIMIT=' $DEF_LOGIN`
X			if [ "$line" ]; then
X				ulimit `expr "$line" : 'ULIMIT=\(.*\)'`
X			fi
X		fi
X		#
X		# Wait a few seconds before kicking off the server; the
X		# thrashing that goes on with finishing the boot after this
X		# script gets run can cause XFree86 to not be able to determine
X		# clocks correctly, delaying start up even more than this
X		# sleep will cause.
X		#
X		(sleep 5; ${XPATH}/bin/xdm) &
X		echo "Started xdm"
X	else
X		echo "${XPATH}/bin/xdm not found!"
X	fi
X	;;
'stop')
X	#
X	# See if xdm is running or not.  If xdm has already been killed
X	# by some other means, this will just clean things up.
X	#
X	if [ -f ${XPATH}/lib/X11/xdm/xdm-pid ]
X	then
X		i=`cat ${XPATH}/lib/X11/xdm/xdm-pid`
X		kill $i 2>/dev/null
X		ps -p $i > /dev/null 2>&1
X		if [ "$?" = "0" ]
X		then
X			#
X			# Some times xdm doesn't die right away, so try
X			# again.
X			#
X			sleep 3
X			kill $i 2>/dev/null
X		fi
X		#
X		# Remove existing pseudo-lock files.
X		#
X		rm -f ${XPATH}/lib/X11/xdm/xdm-pid
X		rm -f ${XPATH}/lib/X11/xdm/.badexit
X		echo "Killed xdm"
X	fi
X	;;
*)
X	echo "usage: /etc/init.d/Xdm {start|stop}"
X	;;
esac
SHAR_EOF
chmod 0755 Xdm ||
echo 'restore of Xdm failed'
Wc_c="`wc -c < 'Xdm'`"
test 2762 -eq "$Wc_c" ||
	echo 'Xdm: original size 2762, current size' "$Wc_c"
fi
# ============= Xreset_0 ==============
if test -f 'Xreset_0' -a X"$1" != X"-c"; then
	echo 'x - skipping Xreset_0 (File already exists)'
else
echo 'x - extracting Xreset_0 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Xreset_0' &&
sessreg -d -l $DISPLAY $USER
SHAR_EOF
chmod 0755 Xreset_0 ||
echo 'restore of Xreset_0 failed'
Wc_c="`wc -c < 'Xreset_0'`"
test 29 -eq "$Wc_c" ||
	echo 'Xreset_0: original size 29, current size' "$Wc_c"
fi
# ============= Xresources ==============
if test -f 'Xresources' -a X"$1" != X"-c"; then
	echo 'x - skipping Xresources (File already exists)'
else
echo 'x - extracting Xresources (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Xresources' &&
xlogin*login.translations: #override\
X	Ctrl<Key>R: abort-display()\n\
X	<Key>F1: set-session-argument(failsafe) finish-field()\n\
X	Ctrl<Key>Return: set-session-argument(failsafe) finish-field()\n\
X	<Key>Return: set-session-argument() finish-field()
xlogin*borderWidth: 3
xlogin*greeting: Welcome to CLIENTHOST
xlogin*namePrompt: login:\ 
xlogin*fail: Login incorrect
#ifdef COLOR
xlogin*greetColor: CadetBlue
xlogin*failColor: red
*Foreground: black
*Background: #fffff0
#else
xlogin*Foreground: black
xlogin*Background: white
#endif
X
XXConsole.text.geometry:	480x130
XXConsole.verbose:	true
XXConsole*iconic:	true
XXConsole*font:		fixed
X
Chooser*geometry:		700x500+300+200
Chooser*allowShellResize:	false
Chooser*viewport.forceBars:	true
Chooser*label.font:		*-new century schoolbook-bold-i-normal-*-240-*
Chooser*label.label:		XDMCP Host Menu  from CLIENTHOST
Chooser*list.font:		-*-*-medium-r-normal-*-*-230-*-*-c-*-iso8859-1
Chooser*Command.font:		*-new century schoolbook-bold-r-normal-*-180-*
SHAR_EOF
chmod 0644 Xresources ||
echo 'restore of Xresources failed'
Wc_c="`wc -c < 'Xresources'`"
test 994 -eq "$Wc_c" ||
	echo 'Xresources: original size 994, current size' "$Wc_c"
fi
# ============= Xservers ==============
if test -f 'Xservers' -a X"$1" != X"-c"; then
	echo 'x - skipping Xservers (File already exists)'
else
echo 'x - extracting Xservers (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Xservers' &&
#
# Xservers file, workstation prototype
#
# This file should contain an entry to start the server on the
# local display; if you have more than one display (not screen),
# you can add entries to the list (one per line).  If you also
# have some X terminals connected which do not support XDMCP,
# you can add them here as well.  Each X terminal line should
# look like:
#	XTerminalName:0 foreign
#
:0 local /usr/X11R6/bin/X vt06
SHAR_EOF
chmod 0644 Xservers ||
echo 'restore of Xservers failed'
Wc_c="`wc -c < 'Xservers'`"
test 430 -eq "$Wc_c" ||
	echo 'Xservers: original size 430, current size' "$Wc_c"
fi
# ============= Xsession ==============
if test -f 'Xsession' -a X"$1" != X"-c"; then
	echo 'x - skipping Xsession (File already exists)'
else
echo 'x - extracting Xsession (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Xsession' &&
#!/bin/sh
# $XConsortium: XdmConf.svr4 /main/3 1996/02/21 17:47:15 kaleb $
#
# Xsession
#
# This is the program that is run as the client
# for the display manager.  This example is
# quite friendly as it attempts to run a per-user
# .xsession file instead of forcing a particular
# session layout
#
X
# redirect errors to a file in user's home directory if we can
for errfile in "$HOME/.xsession-errors" "/tmp/xses-$USER"
do
X	if ( cp /dev/null "$errfile" 2> /dev/null )
X	then
X		chmod 600 "$errfile"
X		exec > "$errfile" 2>&1
X		break
X	fi
done
X
. /etc/profile
X
#
# Get file search paths
#
if [ -f /usr/X11R6/lib/X11/XFilePaths ]
then
X	. /usr/X11R6/lib/X11/XFilePaths
fi
X
#
# Set up user's environment variables.
#
if [ -f $HOME/.login_env ]
then
X	. $HOME/.login_env
fi
X
case $# in
1)
X	case $1 in
X	failsafe)
X		exec xterm -geometry 80x24+0+0
X		;;
X	esac
esac
X
startup=$HOME/.xsession
resources=$HOME/.Xdefaults
X
if [ -f $startup ]; then
X	exec $startup
X	exec /bin/sh $startup
else
X	if [ -f $resources ]; then
X		xrdb -load $resources
X	fi
X	twm &
X	exec xterm -geometry 80x24+10+10 -ls
fi
SHAR_EOF
chmod 0755 Xsession ||
echo 'restore of Xsession failed'
Wc_c="`wc -c < 'Xsession'`"
test 1075 -eq "$Wc_c" ||
	echo 'Xsession: original size 1075, current size' "$Wc_c"
fi
# ============= Xsetup_0 ==============
if test -f 'Xsetup_0' -a X"$1" != X"-c"; then
	echo 'x - skipping Xsetup_0 (File already exists)'
else
echo 'x - extracting Xsetup_0 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Xsetup_0' &&
#!/bin/sh
xconsole -geometry 480x130+0+0 -daemon -notify -verbose -fn 8x13bold -exitOnFail
SHAR_EOF
chmod 0755 Xsetup_0 ||
echo 'restore of Xsetup_0 failed'
Wc_c="`wc -c < 'Xsetup_0'`"
test 91 -eq "$Wc_c" ||
	echo 'Xsetup_0: original size 91, current size' "$Wc_c"
fi
# ============= Xstartup_0 ==============
if test -f 'Xstartup_0' -a X"$1" != X"-c"; then
	echo 'x - skipping Xstartup_0 (File already exists)'
else
echo 'x - extracting Xstartup_0 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Xstartup_0' &&
sessreg -a -l $DISPLAY $USER
SHAR_EOF
chmod 0755 Xstartup_0 ||
echo 'restore of Xstartup_0 failed'
Wc_c="`wc -c < 'Xstartup_0'`"
test 29 -eq "$Wc_c" ||
	echo 'Xstartup_0: original size 29, current size' "$Wc_c"
fi
# ============= profile ==============
if test -f 'profile' -a X"$1" != X"-c"; then
	echo 'x - skipping profile (File already exists)'
else
echo 'x - extracting profile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'profile' &&
#
# .profile - sample file
#
# Version 1.0 - 6/12/92
#   David E. Wexelblat <dwex@goblin.org>
#
# Version 1.1 - 6/24/92
#   Add XFilePaths file
#
X
#
# ${HOME}/.login_env contains all of the environment settings that you
# want to make available whether running from xdm or from a normal login.
#
if [ -f ${HOME}/.login_env ]
then
X    . ${HOME}/.login_env
else
X    MAIL=/usr/mail/${LOGNAME:?}; export MAIL
X    ENV=${HOME}/.kshrc; export ENV
fi
X
#
# This variable lets you use the same file for .xsession (xdm) and 
# .xinitrc (startx) (i.e. link them together).  You can check this
# variable and you will know which login method was used.
#
DOTPROFILE=1; export DOTPROFILE
X
t=`tty`
if [ "$t" = "/dev/console" ]
then
X    #
X    # Logged in on the console - check if xdm is running.  If not,
X    # see if the user wants to start up X.
X    #
X    if [ ! -f /usr/X11R6/lib/X11/xdm/xdm-pid ]
X    then
X    	WINSYSTEM=2
X	XDT=0
X	OLWM=0
X    	echo "Choose window system:"
X    	echo "	None          - 0"
X    	echo "	Open Look     - 1"
X    	echo "	Motif         - 2"
X    	echo "	MIT/XFree86   - 3"
X	echo "	X.desktop     - 4 [default=$WINSYSTEM]: \c"
X    	read t
X    	if [ "$t" != "" ]
X    	then
X            WINSYSTEM=$t
X        fi
X	
X        case $WINSYSTEM in
X    	0)
X    	    WM=none
X    	    ;;
X    	1)
X    	    . $HOME/.olsetup	 #!@ Do not edit this line !@
X      	    WM=/usr/X/bin/olwsm
X	    OLWM=1
X	    ;;
X	2)
X	    WM=/usr/X/bin/mwm
X	    ;;
X	3)
X	    WM=/usr/X11R6/bin/twm
X	    ;;
X	4)
X	    XDT=1
X	    ;;
X	esac
X	export WM XDT OLWM
X	if [ "$WM" != "none" ]
X	then
X	    PATH=$PATH:/usr/X11R6/bin:/usr/X386/bin:/usr/bin/X11
X
X            #
X	    # Get file search paths
X	    #
X	    if [ -f /usr/X11R6/lib/X11/XFilePaths ]
X	    then
X		. /usr/X11R6/lib/X11/XFilePaths
X	    fi
X
X 	    startx &
X	fi
X    fi
elif [ "${t##/dev/vt}" = "$t" -a "${t##/dev/pts}" = "$t" ]
then
X    #
X    # Not /dev/console, not /dev/vt??, and not /dev/pts???
X    #
X    echo "TERM=($TERM): \c"
X    read t
X    if [ "$t" != "" ]
X    then
X    	TERM=$t
X    fi
X    export TERM
fi
X
SHAR_EOF
chmod 0644 profile ||
echo 'restore of profile failed'
Wc_c="`wc -c < 'profile'`"
test 2029 -eq "$Wc_c" ||
	echo 'profile: original size 2029, current size' "$Wc_c"
fi
# ============= xdm-config ==============
if test -f 'xdm-config' -a X"$1" != X"-c"; then
	echo 'x - skipping xdm-config (File already exists)'
else
echo 'x - extracting xdm-config (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdm-config' &&
DisplayManager.errorLogFile:	/usr/X11R6/lib/X11/xdm/xdm-errors
DisplayManager.pidFile:		/usr/X11R6/lib/X11/xdm/xdm-pid
DisplayManager.keyFile:		/usr/X11R6/lib/X11/xdm/xdm-keys
DisplayManager.servers:		/usr/X11R6/lib/X11/xdm/Xservers
DisplayManager.accessFile:	/usr/X11R6/lib/X11/xdm/Xaccess
DisplayManager._0.authorize:	true
DisplayManager._0.grabServer:	false
DisplayManager._0.setup:	/usr/X11R6/lib/X11/xdm/Xsetup_0
DisplayManager._0.startup:	/usr/X11R6/lib/X11/xdm/Xstartup_0
DisplayManager._0.reset:	/usr/X11R6/lib/X11/xdm/Xreset_0
DisplayManager._0.userPath:	/usr/local/bin:/usr/bin:/usr/sbin:/usr/ucb:/usr/X11R6/bin:/usr/X386/bin:/usr/bin/X11
DisplayManager._0.systemPath:	/sbin:/usr/sbin:/etc:/usr/bin:/usr/ucb:/usr/local/bin:/usr/X11R6/bin:/usr/X386/bin:/usr/bin/X11
DisplayManager*resources:	/usr/X11R6/lib/X11/xdm/Xresources
DisplayManager*session:		/usr/X11R6/lib/X11/xdm/Xsession
DisplayManager*authComplain:	false
DisplayManager.exportList:	TZ HZ
SHAR_EOF
chmod 0644 xdm-config ||
echo 'restore of xdm-config failed'
Wc_c="`wc -c < 'xdm-config'`"
test 960 -eq "$Wc_c" ||
	echo 'xdm-config: original size 960, current size' "$Wc_c"
fi
# ============= xsession ==============
if test -f 'xsession' -a X"$1" != X"-c"; then
	echo 'x - skipping xsession (File already exists)'
else
echo 'x - extracting xsession (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xsession' &&
#
# .xsession/.xinitrc - sample file
#
# Version 1.0 - 6/12/92
#   David E. Wexelblat <dwex@goblin.org>
#
# Version 1.1 - 6/30/92
#   Added support for all standard xdm authentication formats
#
# Version 1.2 - 8/26/92
#   Added xrdb line for resources to be loaded
#
# Version 1.3 - 10/7/93
#   Clean up authentication stuff
#
X
if [ -f ${HOME}/.Xdefaults ]
then
X	xrdb -merge ${HOME}/.Xdefaults
fi
X
#
# ${HOME}/.profile will set DOTPROFILE=1 and export it.  This allows
# the same file to be used for both .xsession and .xinitrc.
#
if [ "$DOTPROFILE" != "1" ]
then
X	#
X	# Default window manager
X	#
X	WM=/usr/X11R6/bin/twm
X
X	#
X	# Kill off the xconsole that's run by the xdm setup.  This will be
X	# a no-op if there's no xconsole running.
X	#
X	/usr/X11R6/bin/xkill\
X		-id `/usr/X11R6/bin/xwininfo -tree -root | grep xconsole |\
X		awk '{print $1}'` > /dev/null 2>&1
X
X	#
X	# Prompt for a window manager.  The xmessage client is part of
X	# the contributed software, not the core clients.
X	#
X	/usr/X11R6/bin/xmessage -geometry +400+250\
X		-buttons "MWM:1,OLWM:2,TWM:3,XDT:4"\
X		"Select Window Manager"
X	case "$?" in
X	1)
X		WM=/usr/bin/X11/mwm
X		;;
X	2)
X		. $HOME/.olsetup
X		WM=/usr/X/bin/olwsm
X		OLWM=1
X		;;
X	3)
X		WM=/usr/X11R6/bin/twm
X		;;
X	4)
X		XDT=1
X		;;
X	esac
else
X	XMERGE=vga
X	export XMERGE
fi
X
#
# Add .Xauthority entries for display :1, for use with xscope
#
MYHOST=`uname -n`
for i in MIT-MAGIC-COOKIE-1 XDM-AUTHORIZATION-1 SUN-DES-1
do
X	xauth list | grep $i >/dev/null 2>&1
X	if [ "$?" = "0" ]
X	then
X		KEY=`xauth -q list | grep $i | awk '{print $3; exit}'`
X		if [ "$KEY" != "" ]
X		then
X			xauth -q add ${MYHOST}:1 $i $KEY 2>/dev/null
X			xauth -q add ${MYHOST}/unix:1 $i $KEY 2>/dev/null
X		fi
X	fi
done
X
#
# Now do things based on window-manager selection made above
#
if [ "$XDT" = "1" ]
then
X	#
X	# Run X.desktop 3.0
X	#
X	/usr/X/bin/mwm -xrm "Mwm*configFile: /home/dwex/.xdtmwmrc" &
X	/usr/X/bin/xdt3 -xrm "XDesktop3*isRoot: True"
else
X	if [ "$OLWM" = "1" ]
X	then
X		#
X		# Goddam Open Look session manager stomps on .Xdefaults,
X		# whether you tell it to or not!
X		#
X		xrdb -load .Xdefaults
X		cp .Xdefaults .SaveXdefaults
X		cp .OLXdefaults .Xdefaults
X	fi
X	xsetroot -solid gray60
X	xterm -geometry +0+100 &
X	xterm -geometry +360+100 -iconic&
X	xterm -geometry +360+425&
X	xterm -geometry +0+425 -iconic&
X	xconsole -geometry +0+0 -verbose &
X	xclock -geometry +425+0 &
X	xpostme -geometry +522+0 &
X	$WM
X	if [ "$OLWM" = "1" ]
X	then
X		#
X		# Undo Open Look stupidity
X		#
X		cp .Xdefaults .OLXdefaults
X		cp .SaveXdefaults .Xdefaults
X	fi
fi
X
#
# Remove .Xauthority entries for display :1
#
for i in MIT-MAGIC-COOKIE-1 XDM-AUTHORIZATION-1 SUN-DES-1
do
X	xauth list | grep $i >/dev/null 2>&1
X	if [ "$?" = "0" ]
X	then
X		KEY=`xauth -q list | grep $i | awk '{print $3; exit}'`
X		if [ "$KEY" != "" ]
X		then
X			xauth -q remove ${MYHOST}:1 
X			xauth -q remove ${MYHOST}/unix:1 
X		fi
X	fi
done
SHAR_EOF
chmod 0755 xsession ||
echo 'restore of xsession failed'
Wc_c="`wc -c < 'xsession'`"
test 2861 -eq "$Wc_c" ||
	echo 'xsession: original size 2861, current size' "$Wc_c"
fi
exit 0
