# CUBIX System Manager - Main Menu
#
# Created:	 05-Sep-87
# Revision Date: 19-Nov-87
#
# Created By:	 Sandy Marshall
# Modified By:	 Sandy Marshall

# Edit DEFAULT as needed:
DEFAULT="q"

trap "" 2

# Edit TITLE as needed:
TITLE="			  CUBIX SYSTEM MANAGER"
TITL2="			       Version 1.0"
if [ "`echo -n`" = "-n" ]
then
	NLF1=""
	NLF2="\c"
else
	NLF1="-n"
	NLF2=""
fi

while true
do

t=`pwd`
s=`date '+%a %h %d, 19%y'`
bold=`tput smso`
plain=`tput rmso`
clear=`tput clear`
echo $clear

# SHOW ==================================================

cat << TBLOCK
$TITLE
$TITL2

TBLOCK
echo "Present Directory: $t		Date: $s \n"
cat << SHOWEND
			  a. Applications Menu
			  b. Communications Menu
			  c. Basic Utilities Menu
			  d. Printer Control Menu
			  e. System Administration

			  q. Quit			? Help

SHOWEND
#
# Add additional lines before 'SHOWEND' and
# add corresponding entries in 'SELECT' below:
# <tab><letter(s)><tab><description"	# format for additional lines
#
# Use blank lines for visual grouping.
#

# ENTER ==================================================
if mail -e
then	echo $NLF1 "

${bold}you have mail$plain                  Select [$DEFAULT] : $NLF2"
else	echo $NLF1 "

			       Select [$DEFAULT] :  $NLF2"
fi
read SELECT

if [ -z "$SELECT" ]
then
	SELECT=$DEFAULT
fi

DEFAULT=$SELECT
RT="0"

echo $clear

# SELECT ==================================================

case $SELECT in
	a)	sh /usr/bin/app.sh
		EXERR=0						;;

	c)	sh /usr/bin/basic.sh
		EXERR=0						;;

	b)	sh /usr/bin/comm.sh
		EXERR=0						;;

	d)	sh /usr/bin/ptr.sh
		EXERR=0						;;

	e)	sh /usr/bin/admin.sh
		EXERR=0						;;

	\?)	sh /usr/bin/cube.help
		EXERR=0
		RT=1						;;
	
	q)	exit $EXERR					;;


esac

if [ "$EXERR" != "0" ]
then
	echo $NLF1 " Exit error: $EXERR	$NLF2	"
	echo $NLF1 "  Press <RETURN> to continue:  $NLF2"
	read OK
else
	if [ "$RT" = "1" ]
	then
		echo $NLF1 " \n Press <RETURN> to continue:  $NLF2"
		read OK
	fi
fi

done
