#!/bin/sh

# The DISPLAY variable for a local screen is set to :0 or something.  Set
# it to a more universal value, and choose whether to show the log or not.
case "$DISPLAY" in
:*)	DISPLAY="`uname -n`$DISPLAY"
	showlog="tail -f /usr/adm/log"
	;;
*)	showlog=:
esac

if [ "$#:$1" = 1:failsafe -o ! -f .Xsession ]
then
	# User session script doesn't exists, or failsafe option.
	exec xterm -name xterm-console
fi

# Normal session.
exec xterm -name xterm-console -e sh -c \
	"trap '' 2 3 15; $showlog& exec sh .Xsession"
