#!/bin/bash

###############################################################################
#
# this script belongs to susewmif and is ment to start an application 
# indirectly from the menu. doing this by a script gives the possibility e.g
# to check some values or set some variables before program startup
#
###############################################################################

CMDARG=""

if [ -e "$HOME/.xsession-errors" -a \
     "$HOME/.xsession-errors" -nt "$HOME/.X.err" ]; then
    POSS_FILES="$HOME/.xsession-errors"
else
    POSS_FILES=$HOME/.X.err
fi    


for FILE in ${POSS_FILES}; do
	if [ -r "$FILE" ]; then
		CMDARG="$CMDARG $FILE"
	fi
done

if [ ! -z "${CMDARG}" ]; then

    GEOMETRY=71x14+747-20

    if [ "$1" = "-geometry" ]; then
	GEOMETRY="$2"
    fi

    exec xterm -geometry "$GEOMETRY" +sb -T "XMessages" -n "XMessages" -e tail -f ${CMDARG}
fi





