#!/bin/csh -fb
# (The "-fb" might need to be changed to "-f" on some systems)
#
set MYFONTDIR=/afs/cs/project/atk/7.4/pmax_ultrix43/dest//X11fonts

set CHARSET="$1"
shift
if ("$1" == "-e") then
    shift
    set CMD="$*"
    set RIGHTTERMCMD="$*"
else
    set CMD="more $* /dev/null"
    set RIGHTTERMCMD="more $*"
endif
if ($?MM_CHARSET) then
    if ($MM_CHARSET == "$CHARSET") then
	$RIGHTTERMCMD
	exit
    endif
endif
if ($?MM_AUXCHARSETS) then
    if ($MM_AUXCHARSETS =~ *${CHARSET}*) then
	$RIGHTTERMCMD
	exit
    endif
endif
if (! -d $MYFONTDIR) then
    echo This message contains non-ASCII text, but the $CHARSET font
    echo has apparently not yet been installed on this machine.  
    echo "(There is no directory named ${MYFONTDIR}.)"
    echo "What follows may be partially unreadable, but the English (ASCII) parts"
    echo "should still be readable."
    echo ""
    cat $*
    exit 0
endif

if (! $?DISPLAY) then
    echo This message contains non-ASCII text, which can only be displayed
    echo properly if you are running X11.  What follows
    echo "may be partially unreadable, but the English (ASCII) parts"
    echo "should still be readable."
    cat $*
    exit 0
endif
set FPGREP=`xset q | grep $MYFONTDIR`
if ("$FPGREP" == "") then
    echo Adding $MYFONTDIR to your font path.
    xset +fp $MYFONTDIR
else
    echo Your font path appears to be correctly set.
endif
echo Running xterm to display text in $CHARSET, please wait...
unsetenv MM_NOTTTY

# The following line might work better on IBM RT and other machines that 
#      think it smart inhibit 8 bit chars in xterms.
# xterm -fn $CHARSET -tm litout -e $CMD
set XCHARSET=\*`echo $CHARSET | sed -e s/iso-/iso/`
xterm -fn "$XCHARSET" -e $CMD



