#!/bin/sh

#   xtfractint - open xfractint in the best avail terminal
#   Copyright (c) 1996  Martin Schulze <Martin.Schulze@Infodrom.North.DE>
#   Copyright (c) 1997  Riku Voipio <riku.voipio@iki.fi>
#   findcmd Copyright (c) Miquel van Smoorenburg <miquels@cistron.nl>

#   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., 675 Mass Ave, Cambridge, MA 02139, USA.

findcmd()
{
  IFS=:
  for i in $PATH
  do
	if [ -x $i\/$1 ]
	then
		result=$i\/$1
		IFS=
		return 0
	fi
  done
  result=
  IFS=
  return 1
}

if findcmd Eterm
then
  exec $result -n xfractint --geometry 80x25 -e xfractint $*
  exit 1
fi

if findcmd color_xterm
then
  exec $result -bg black -fg grey -n xfractint -geometry 80x25 -e xfractint $*
  exit 1
fi

if findcmd rxvt
then
  exec $result -bg black -fg grey -n xfractint -T xfractint -8 -sl 0 -geometry 80x25 -e xfractint $*
  exit 1
fi

if findcmd xterm
then
  exec $result -n xfractint -geometry 80x25 -e xfractint $*
  exit 1
fi

echo "xfractint: Eterm, rxvt, color_xterm or xterm NOT found!" 1>&2
exit 1

