#!/bin/sh
#
#  gxfce
#
#  Copyright (C) 1999 Olivier Fourdan (fourdan@xfce.org)
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Brilliant script submitted by Joakim Andreasson <karanne@flashback.net>

if [ "x$TERMCMD" = "x" ]
then
  TERMCMD=xterm
fi

if [ "x$1" = "x" ]; then
        exec $TERMCMD
else
        if [ -d "$1" ]; then
                cd "$1"
                exec $TERMCMD -title "Terminal (XFTree)"
        else
                if [ -x "$1" ]; then
                        exec $TERMCMD -e "$1"
                else
                       if [ -f "$1" ]; then
                               exec $TERMCMD -title "Viewing: $1" -e "more '$1'"
                       else
                               exec $TERMCMD $*
                       fi
                fi
        fi
fi
exit 0

