#!/bin/sh
#                                 by Jun Nishii <jun@vinelinux.org>
#                            Time-stamp: <2000-10-10 14:11:09 vine>

# Clean up message log
cp -f /dev/null ${HOME}/.xwm.msgs

# run all system xinitrc shell scripts.
for i in /etc/X11/xinit/xinitrc.d/* ; do
    if [ -x "$i" ]; then
	. "$i"
    fi
done

# Set font path for Xpmac/XFree86-4.0-mga-r128-v2 server (ppc)
if [ -L /etc/X11/X ] ; then
    if [ `/bin/ls -l /etc/X11/X | grep -c Xpmac` -eq 1 ] || \
       [ `/bin/ls -l /etc/X11/X | grep -c mga-r128` -eq 1 ]; then
        if [ -f /usr/X11R6/lib/X11/fonts/TrueType/fonts.dir ] ; then
            xset +fp /usr/X11/lib/X11/fonts/TrueType
        fi
        xset +fp unix/:-1
        xset fp rehash
    fi
fi

# these files are left sitting around by TheNextLevel.
rm -f $HOME/Xrootenv.0
rm -f /tmp/fvwmrc* 2>/dev/null

# The user may have their own clients they want to run.  If they don't,
# fall back to system defaults.

if [ -f $HOME/.Xclients ]; then
    exec $HOME/.Xclients
elif [ -f /etc/X11/xinit/Xclients ]; then
    exec /etc/X11/xinit/Xclients
else
       # failsafe settings.  Although we should never get here
       # (we provide fallbacks in Xclients as well) it can't hurt.
       xclock -geometry 100x100-5+5 &
       kterm -geometry 80x50-50+150 &
       if [ -f /usr/doc/HTML/index.html ]; then
               ${BROWSER} /usr/doc/HTML/index.html &
       fi
       if [ -f /usr/X11R6/bin/fvwm ]; then
               exec fvwm
       else
               exec twm
       fi
fi
