;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   Login script for terminating an AmiTCP/SLIRP connection using
;   IPDial
;
;   Version 1.1,    06.12.1994
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   The line below *must* be present and *must* be the first command
;   line in the script. It specifies the device and the protocol to
;   use. (Possible protocols are 7WIRE ( =RTSCTS), XONXOFF or NONE.)
;   You may omit the protocol, in which case the defaults of the
;   serial.device are used.
;
;   Be sure, that the parameters you are using in this script are the
;   same as used for initializing AmiTCP/IP!

    DEVICE serial.device 7WIRE


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   Certain settings (Note, that these override the respective settings
;   of the serial.prefs.)
;
;   Possible settings are:
;   BAUD               Baudrate, integer
;   DATABITS           number of data bits, integer
;   STOPBITS           number of stop bits, integer
;   BUFSIZE            Read buffer size, integer
;   PARITY          one of NONE, ODD or EVEN
;  PROTOCOL        one of 7WIRE XONXOFF or NONE
;

    set BAUD=38400 DATABITS=8 STOPBITS=1 BUFSIZE=4096 PARITY=NONE

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   Stop slirp automatically (usually it would be suffice just to ATH0)

DELAY 3
SEND 0
DELAY 1
SEND 0
DELAY 1
SEND 0
DELAY 1
SEND 0
DELAY 1
SEND 0
DELAY 1
SEND 0
DELAY 1
SEND \rbye\r
DELAY 3
SEND "+"
DELAY 0 100
SEND "+"
DELAY 0 100
SEND "+"
DELAY 0 100
WAIT TIMEOUT=3 "NO CARRIER" "OK"
ON STATUS GOTO TIMEOUT

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   Now tell the modem to disconnect

Hangup:
    DELAY 1
    SEND "ATH0\r"
    WAIT TIMEOUT=5 "NO CARRIER" "OK"
    ON STATUS GOTO TIMEOUT

    ECHO "Disconnected.\n"
    EXIT 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   Error message: Timeout

TIMEOUT:
    ECHO "\nTimeout. Entering terminal mode.\n"
    TERMINAL NOECHO RAW
    EXIT 0
