#!/bin/sh
# Generated automatically from mailto-hebrew.in by configure.
#
prefix=/usr/local
MYFONTDIR=${prefix}/share

#
# if charset matches the one we're using, no need to start an xterm
#
case "$MM_CHARSET" in
    "") ;;
    *)
	if [ "$MM_CHARSET" = "iso-8859-8" ]; then
	    mailto "${@:-}"
	    exit
	fi ;;
esac

#
# if no display is set, we're either not running under X or we
# don't know what the display name is.  either way, we can't
# fire up an xterm..
#
case "$DISPLAY" in
    "") 
	echo "No DISPLAY environment variable is set."
	echo "Hebrew mail may only be composed under X11 or on a Hebrew terminal."
	exit ;;
esac

YCHARSET="`xlsfonts -fn '*-iso8859-8' | head -1`"
case "$YCHARSET" in
    "")
	if [ -d "$MYFONTDIR" ] ; then
	    case "`xset q | grep $MYFONTDIR`" in
		"")
		    echo "Adding $MYFONTDIR to your font path."
		    set fp+ "$MYFONTDIR" ;;
	    esac
	    YCHARSET="`xlsfonts -fn '*-iso8859-8' | head -1`"
	fi ;;
esac
case "$YCHARSET" in
    "")
	echo "No Hebrew font has been installed on this machine."
	exit ;;
esac

echo "Running xterm to compose mail in iso-8859-8, please wait..."

export MM_CHARSET=iso-8859-8
xterm -fn '*iso8859-8' -e mailto "${@:-}"
