!
! InterSLIP gateway script for Cisco terminal server
!
! Label 99 is the general purpose error handler, which beeps
! and pauses long enough for the user to read the message.
!
! First, we wait for the user name prompt
!
@originate
note "Waiting for prompt"
matchclr
matchstr 1 1 "Username: "
matchread 50
note "No username prompt"
jump 99
!
! Now, send the user name and wait for the password prompt
!
@label 1
note "Sending user name"
write "^5\13"
matchclr
matchstr 1 2 "Password:"
matchread 50
note "No password prompt"
jump 99
!
! Send the password and wait for either the terminal server
! prompt or an error message
!
@label 2
note "Sending password"
write "^6\13"
matchclr
matchstr 1 4 ">"
matchstr 2 3 "Access denied"
matchread 120
jump 99
!
! If we got an error message, notify the user and fail
!
@label 3
note "Access Denied"
!
! General purpose error handler.  Let the message appear,
! beep, and then pause for a second.
!
@label 99
pause 1
sound
pause 60
exit -1
!
! If we've successfully logged in, ask for SLIP mode and
! wait for the response.  If we get anything except
! "Entering SLIP mode.", assume something went wrong, and fail.
!
@label 4
note "Requesting SLIP"
write "slip\13"
matchclr
matchstr 1 5 "Entering SLIP mode."
matchread 120
note "Cannot invoke SLIP mode"
jump 99
!
! We've entered SLIP mode, so match on the first thing that
! looks like an IP address.  If we don't find one, fail.
!
@label 5
matchclr
matchexp 1 6 "[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*\\."
matchread 120
note "No IP address given"
jump 99
!
! We've found an IP address, so inform MacTCP of it, and
! watch for a number (the MTU size).
!
@label 6
setip "^0"
note "IP address is:  ^0"
pause 300
matchclr
matchexp 1 7 "[0-9][0-9]*"
matchread 120
note "No MTU value"
jump 99
!
! We found the MTU size, so inform MacTCP and exit
! the script successfully.
!
@label 7
setmtu "^0"
exit 0
!
! Answer and Hangup modes are currently unused in gateway
! scripts, but just for future compatibility, exit successfully.
!
@answer
@hangup
exit 0