#!/bin/sh
#
# This wrapper script is part of the "cream" Debian GNU/Linux package
# maintained by Christoph Haas <haas@debian.org>.

# Exit on error
set -e

CREAM=/usr/share/vim/cream/
export CREAM

# Due to limitations of text consoles/terminals cream can only run
# as a GUI variant.
if [ "$DISPLAY" = "" ] ; then
	echo "Sorry. 'cream' can only be run in an X environment."
	exit 10;
fi

# Run kvim or gvim - whichever is available.
if [ -x /usr/bin/gvim ] ; then
    exec /usr/bin/gvim --servername "CREAM" -U NONE -u "\$VIM/cream/creamrc" "$@"
else
	echo "You need 'gvim' installed to run 'cream'."
	exit 10;
fi
