-# redirect errors to a file in user's home directory if we can
-for errfile in "${TMPDIR-/tmp}/.xsession-$USER" \
- "/tmp/.xsession-$USER" \
- "$HOME/.xsession-errors"
-do
- if cp /dev/null "$errfile" 2> /dev/null ; then
- chmod 600 "$errfile"
- exec > "$errfile" 2>&1
- break
- fi
-done
-
-[ "`echo $PATH | grep -q /usr/X11R6/bin`" = "" ] && PATH="${PATH}:/usr/X11R6/bin"
-[ "`echo $PATH | grep -q "$HOME/bin"`" = "" ] && PATH="$PATH:$HOME/bin"
-
-test -f /etc/profile && . /etc/profile
-test -f $HOME/.profile && . $HOME/.profile
-
-if [ ! -f $HOME/.profile ] && echo $SHELL |grep -q "bash"; then
- test -f $HOME/.bash_profile && . $HOME/.bash_profile
-fi
-
-userresources=$HOME/.Xresources
-usermodmap=$HOME/.Xmodmap
-userxkbmap=$HOME/.Xkbmap
-
-sysresources=/etc/X11/Xresources
-sysmodmap=/etc/X11/Xmodmap
-sysxkbmap=/etc/X11/Xkbmap
-
-# merge in defaults
-[ -f "$sysresources" ] && xrdb -merge "$sysresources"
-[ -f "$userresources" ] && xrdb -merge "$userresources"
-
-# merge in keymaps
-if [ -f "$sysxkbmap" ]; then
- setxkbmap `cat "$sysxkbmap"`
- XKB_IN_USE=yes
+# Make it login shell
+if [ "$HAVE_LOGIN_SHELL" != "yes" ]; then
+ export HAVE_LOGIN_SHELL=yes
+ case $SHELL in
+ */csh|*/tcsh)
+ # [t]cshrc is always sourced automatically.
+ # Note that sourcing csh.login after .cshrc is non-standard.
+ exec $SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; exec $0 $*"
+ ;;
+ *)
+ exec $SHELL -l $0 $*
+ esac