home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / internet-tools / ipdial / examples / login-slip.ipdial < prev    next >
Encoding:
Text File  |  1996-04-16  |  3.6 KB  |  140 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;
  3. ;   Example IPDial 2.1 login script for AmiTCP with SLIP/CSLIP
  4. ;   $VER: Login-SLIP.IPDial 2.1 (16.04.96)
  5. ;
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7. ;
  8. ;   The line below *must* be present and *must* be the first command
  9. ;   line in the script if you don't use the command line option SANADEV.
  10. ;   It specifies the device, unit, baudrate and the protocol to use (7WIRE,
  11. ;   XONXOFF or NONE). You may omit the unit, baudrate and protocol, in which
  12. ;   case the defaults are used (see manual).
  13. ;
  14. ;   Be sure, that the parameters you are using in this script are the
  15. ;   same as used for initializing AmiTCP/IP (or use SANADEV)!
  16.  
  17.     DEVICE serial.device UNIT=0 BAUD=38400 7WIRE
  18.  
  19.  
  20. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  21. ;
  22. ;   Send initialization command
  23.  
  24.     SEND "\r\n"
  25.     DELAY 1
  26.     SEND "ATZ\r"
  27.  
  28.  
  29. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  30. ;
  31. ;   Wait for the modems ok; break, if timeout (default: 5 seconds)
  32.  
  33.     WAIT "OK"
  34.     ON STATUS GOTO TIMEOUT
  35.  
  36.  
  37. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  38. ;
  39. ;   Initialize the modem not to hang up, when IPDial terminates (this
  40. ;   will make DTR becoming low)
  41.  
  42.     SEND "AT&D0\r"
  43.     WAIT "OK"
  44.     ON STATUS GOTO TIMEOUT
  45.  
  46.  
  47. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  48. ;
  49. ;   Dialing ...
  50.  
  51. Dial:
  52.     ECHO "Dialing...\n"
  53.     SEND "ATDP XXXXXXXXXX\r"
  54.     WAIT TIMEOUT=60 "CONNECT" "NO CARRIER" "BUSY" "DELAYED"
  55.     ON STATUS GOTO TIMEOUT Login NoCarrier
  56.  
  57.  
  58. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  59. ;
  60. ;   The usual case: Our Remote is busy. :-(
  61. ;   We do a delay of 30 secs and dial again.
  62.  
  63.     ECHO "Remote busy, delaying 30 seconds...\n"
  64.     DELAY 30
  65.     GOTO Dial
  66.  
  67.  
  68. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  69. ;
  70. ;   Okay, we are connected. Login into the host. It is a local
  71. ;   convention that we have to enter the password twice.
  72.  
  73. Login:
  74.     ECHO "Connection established!\n"
  75.  
  76.     WAIT TIMEOUT=10 "login:"
  77.     SEND "MyAccount\r"
  78.  
  79.     WAIT "password:"
  80.     ON STATUS GOTO TIMEOUT
  81.     SEND "MyPassword\r"
  82.  
  83.     WAIT TIMEOUT=10 "shell>"
  84.     ON STATUS GOTO TIMEOUT
  85.     SEND "slip\r"
  86.  
  87. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  88. ;
  89. ;   If we came so far, everything is fine. AmiTCP and SLIP may be started.
  90. ;
  91. ;   Remote host will answer with a string like
  92. ;
  93. ;       Your IP address is 134.2.1.23, MTU 1524 bytes.
  94. ;
  95. ;   Scan this and store the values into the environment variables
  96. ;   IPADDRESS and MTU, so that they can be used by the startnet script.
  97. ;
  98. ;   Attention: the SCAN command works on the buffer that was received by
  99. ;   the last WAIT command, so
  100. ;
  101. ;   WAIT TIMEOUT=10 "Your IP address"
  102. ;
  103. ;   won't work!
  104.  
  105.     WAIT TIMEOUT=10 "bytes"
  106.     SCAN "%{Your IP address is%} %[IPADDRESS%]%(,%) %{MTU%} %[MTU%]" GLOBAL
  107.     ON STATUS GOTO NeverHappens ScanError ScanError
  108.  
  109.     ECHO "SLIP connection ready, starting AmiTCP.\n"
  110.     EXIT 0
  111.  
  112.  
  113. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  114. ;
  115. ;   Error message: Timeout
  116.  
  117. TIMEOUT:
  118.     ECHO "\nTimeout. Entering terminal mode!\n"
  119.     TERMINAL NOECHO RAW
  120.     EXIT 10
  121.  
  122.  
  123. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  124. ;
  125. ;   Error message: NO CARRIER
  126.  
  127. NoCarrier:
  128.     ECHO "\nNError: NO CARRIER.\n"
  129.     EXIT 10
  130.  
  131.  
  132. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  133. ;
  134. ;   Error message: SCAN error
  135.  
  136. ScanError:
  137.     ECHO "\nNError: Could not set environment variables.\n"
  138.     EXIT 10
  139.  
  140.