#!/bin/sh
#
#	/usr/athena/xolc
#
#	This script attaches the filesystem containing the X version
#	of OLC, then executes it.  If the program cannot be found, or
#	if it exits with status -1, an appropriate message is displayed.
#
#	$Source: /paris/source/4.3/usr.athena/RCS/xolc.sh,v $
#	$Author: epeisach $
#	$Header: /paris/source/4.3/usr.athena/RCS/xolc.sh,v 1.2 89/12/06 15:05:19 epeisach Exp $
#

UNAVAILABLE=0; export UNAVAILABLE
MACHTYPE=`/bin/athena/machtype`; export MACHTYPE
XOLC_PROGRAM=/mit/xolc/${MACHTYPE}bin/xolc; export XOLC_PROGRAM
XOLC_LOCKER=xolc; export XOLC_LOCKER

if [ ! -r $XOLC_PROGRAM ]
then
      /bin/athena/attach -q -n $XOLC_LOCKER
fi

if [ -r $XOLC_PROGRAM ]
then
	$XOLC_PROGRAM $*
	if [ $? -eq -1 ]
	then
		UNAVAILABLE=1; export UNAVAILABLE
	fi
else
	UNAVAILABLE=1; export UNAVAILABLE
fi

if [ $UNAVAILABLE -eq 1 ]
then
	echo "
Sorry, XOLC is currently unavailable.
Try using the text interface to OLC instead.
Simply type:

	olc

"
fi
