#!/bin/sh

# Based on: $XConsortium: Xsession,v 1.7 92/08/06 11:08:14 gildea Exp $

resources=$HOME/.Xresources
userenv=/usr/bin/X11/userenv

if [ -r $resources ]; then
	xrdb -load -quiet $resources
fi

# save the hostname, so it can be used for renaming the desktop file
host=`hostname`

XUSERFILESEARCHPATH="$HOME/.desktop-`hostname`/%N:`/usr/bin/X11/appdefpath`"
export XUSERFILESEARCHPATH

if [ -x $userenv ]; then
	#
	# Find user's environment as set up during a login
	#  shell, and add that to current environment.
	#
	eval `$userenv`
fi

#
# Note: Output from $HOME/.sgisession, 4Dwm, workspace and toolchest
# is redirected to /dev/console. All other output is written to 
# /usr/adm/SYSLOG by default (or where the X11R5 redirection makes it go
# if the above X11R5 redirection lines above are uncommented).
#

/usr/bin/X11/4Dwm >/dev/console 2>&1 &
/usr/bin/X11/wait4wm

#
# Do language dependent stuff
intlenv=`gettxt uxsgidesktop:452 ':'`
eval ${intlenv}

/usr/Cadmin/bin/csetup
# make sure the desktop directory is just called .desktop
mv .desktop-$host .desktop
exit 0
