#!/bin/sh

if [ ! -z "$EDITOR" ] ; then
	if [ -f $EDITOR ] ; then
		exec $EDITOR $@
	else if [ -f /usr/bin/$EDITOR ] ; then
		exec /usr/bin/$EDITOR $@
	else if [ ! -z "`which $EDITOR 2> /dev/null`" ] ; then
        	exec `which $EDITOR` $@
	else
		echo "Error: Could not find the $EDITOR editor specified by eviornment variable EDITOR"
		exit 1
	fi
	fi
	fi

else
	if [ -f /usr/bin/vim ]; then
		exec /usr/bin/vim $@
	else if [ -f /usr/bin/nvi ]; then
		exec /usr/bin/nvi $@
	else if [ -f /usr/bin/nano ]; then
		exec /usr/bin/nano $@
	else if [ -f /usr/bin/jed ]; then
		exec /usr/bin/jed $@
	else 

		echo "Error: No editor could be found"
		exit 1
	fi
	fi
	fi
	fi

fi 
	 
