@echo 0
@rem *************************************************************************
@rem ****  telnet.scr: Establish a connection to fibs from the telnet      ***
@rem ****              command prompt. Assumes that we are not already in  ***
@rem ****              telnet. Will attempt to retry if neccessary         ***
@rem *************************************************************************

@echo "\r\n** Starting telnet...\r\n"
@:RetryTelnet
@   send  "telnet\r"
@if not @wait  "telnet>" 30
@    echo \r** Error(telnet.scr): Failed to start telnet.\r\n"
<
@endif

@echo "\r\n** Connecting to FIBS via telnet\r\n"
@send "\r"
@if not @wait "telnet>" 30
@    echo "\r\n** Error(telent.scr): Failed to establish telnet connection\r\n"
<
@endif

@:RetryTelnetConnect
@   send "open %FibsInternetAddress% %FibsTelnetPort%\r"
@if not @wait "Escape character is" 30
@    rem The connection failed. Retry it.
@    echo "\r\n** Connect failed: Retrying connection...\r\n"
@    send "close\r"
@    if not @wait "telnet>" 30
@       echo "\r\n** Error(telnet.scr): Failed to close telnet connection\r\n"
<
@    endif
@    goto RetryTelnetConnect
@endif
@wait "\n" 50

@rem ********************************************************************
@rem **** The telnet connection has been made. Now login in to FIBS
@rem ********************************************************************

<fibslogn.scr
