#!/bin/sh
#
# (C) 1994 Free Software Assiociation of Germany
#
#  Sample script that demontrates the use of quest & Answer
#
#
###########################################################

CONN_HOST=`Answer -g +300+300 -title Ftp Session\
	 -label "Enter Host" -hno -cstr "Abort"\
	 -ostr "Connect to Host" -prev "$MAN_PAGE"`
exec_code=$?
if [ $exec_code = 0 ]
then
	exit 1
fi


if [ -z $CONN_HOST ]
then
	quest -timo 5 -msg_t 0 -msg "You must enter a host" -cno -hno -ostr "Oops"\
		 -goodie "psound $GREAT_SOUND_DIR/Oops.au &"\
		 -title "mxftp : Input Error"
	exit 1
fi

ERROR=`ping -c 1 $CONN_HOST 2>&1` 

if [ $? = 1 ]
then
	quest -timo 5 -msg_t 0 -msg "$ERROR" -cno -hno -ostr "Oops"\
		 -goodie "psound $GREAT_SOUND_DIR/Oops.au &"\
		 -title "`basename $0`: Unknown Host"
	exit 1
fi

$GREAT_TERM -xrm "*iconName: Telnet [ $CONN_HOST ]" -e telnet $CONN_HOST


