#!/usr/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# gos720 src/gos/2d/XTOP_R7/app/xdm/config/Xsession.cpp 1.2.1.1 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2006,2012 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
#
# SCCSID_BEGIN_TAG
# @(#)53 1.2.1.1 src/gos/2d/XTOP_R7/app/xdm/config/Xsession.cpp, xdmcp, gos720 3/1/12 04:27:01
# SCCSID_END_TAG
# $XdotOrg: $
# $Xorg: Xsession,v 1.4 2000/08/17 19:54:17 cpqbld Exp $
# $XFree86: xc/programs/xdm/config/Xsession,v 1.2 1998/01/11 03:48:32 dawes Exp $

# redirect errors to a file in user's home directory if we can

errfile="$HOME/.xsession-errors"
if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
then
	exec > "$errfile" 2>&1
else

	mktemp=
 	for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
	do
		if ef="$( umask 077 && $mktemp "$errfile.XXXXXX" 2> /dev/null)"
		then
			exec > "$ef" 2>&1
			mv "$ef" "$errfile" 2> /dev/null
 			break
 		fi
	done

fi






case $DISPLAY in
  :0|:0.*|localhost:0|localhost:0.*|unix:0|unix:0.*)
	XSTATION="";;
  *)
	XSTATION=$DISPLAY;export XSTATION;;
esac

case $# in
1)
	case $1 in
	failsafe)
		exec /usr/bin/X11/xterm -geometry 80x24-0-0
		;;
	esac
esac

# The startup script is not intended to have arguments.

startup=$HOME/.xsession
resources=$HOME/.Xresources


if [ -f /usr/bin/X11/startx ]; then
        exec /usr/bin/X11/startx -t -wait
fi


if [ -s "$startup" ]; then
	if [ -x "$startup" ]; then
		exec "$startup"
	else
		exec /bin/sh "$startup"
	fi
else
	if [ -r "$resources" ]; then
		/usr/bin/X11/xrdb -load "$resources"
	fi

	exec /usr/bin/X11/xsm
fi