home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / DIP / _DIP.TAR / usr / doc / dip / samples / sample.dip < prev    next >
Encoding:
Text File  |  1995-01-13  |  2.2 KB  |  95 lines

  1. #
  2. # sample.dip    Dialup IP connection support program.
  3. #        This file (should show) shows how to use the DIP
  4. #        scripting commands to establish a link to a host.
  5. #        This host runs the 386bsd operating system, and
  6. #        thus can only be used for the "static" addresses.
  7. #
  8. # NOTE:        We also need an examnple of a script used to connect
  9. #        to a "dynamic" SLIP server, like an Annex terminal
  10. #        server...
  11. #
  12. # Version:    @(#)sample.dip    1.40    07/20/93
  13. #
  14. # Author:    Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  15. #
  16.  
  17. main:
  18.   # First of all, set up our name for this connection.
  19.   # I am called "uwalt.hacktic.nl"  (== 193.78.33.238)
  20.   get $local uwalt.hacktic.nl
  21.  
  22.   # Next, set up the other side's name and address.
  23.   # My dialin machine is called 'xs4all.hacktic.nl' (== 193.78.33.42)
  24.   get $remote xs4all.hacktic.nl
  25.   # Set netmask on sl0 to 255.255.255.0
  26.   netmask 255.255.255.0
  27.   # Set the desired serial port and speed.
  28.   port cua02
  29.   speed 38400
  30.  
  31.   # Reset the modem and terminal line.
  32.   # This seems to cause trouble for some people!
  33.   reset
  34.  
  35. # Note! "Standard" pre-defined "errlevel" values:
  36. #    0 - OK
  37. #    1 - CONNECT
  38. #    2 - ERROR
  39. #
  40. # You can change those grep'ping for "addchat()" in *.c...
  41.  
  42.   # Prepare for dialing.
  43.   send ATQ0V1E1X4\r
  44.   wait OK 2
  45.   if $errlvl != 0 goto modem_trouble
  46.   dial 555-1234567
  47.   if $errlvl != 1 goto modem_trouble
  48.  
  49.   # We are connected.  Login to the system.
  50. login:
  51.   sleep 2
  52.   wait ogin: 20
  53.   if $errlvl != 0 goto login_error
  54.   send MYLOGIN\n
  55.   wait ord: 20
  56.   if $errlvl != 0 goto password_error
  57.   send MYPASSWD\n
  58. loggedin:
  59.  
  60.   # We are now logged in.
  61.   wait SOMETEXT 15
  62.   if $errlvl != 0 goto prompt_error
  63.  
  64.   # Set up the SLIP operating parameters.
  65.   get $mtu 296
  66.   # Ensure "route add -net default xs4all.hacktic.nl" will be done
  67.   default
  68.  
  69.   # Say hello and fire up!
  70. done:
  71.   print CONNECTED $locip ---> $rmtip
  72.   mode CSLIP
  73.   goto exit
  74.  
  75. prompt_error:
  76.   print TIME-OUT waiting for SLIPlogin to fire up...
  77.   goto error
  78.  
  79. login_trouble:
  80.   print Trouble waiting for the Login: prompt...
  81.   goto error
  82.  
  83. password:error:
  84.   print Trouble waiting for the Password: prompt...
  85.   goto error
  86.  
  87. modem_trouble:
  88.   print Trouble ocurred with the modem...
  89. error:
  90.   print CONNECT FAILED to $remote
  91.   quit
  92.  
  93. exit:
  94.   exit
  95.