###############################################################################
# DIP script to connect to a Xylogics Micro Annex
# Written by Kevin Layer (layer@franz.com) with help from John
#   Foderaro (jkf@franz.com).

  # Fetch the IP address of our target host.
main:

  # Set the desired serial port and speed.
  port /dev/modem
  speed 38400

  # Reset the modem and terminal line.
  reset

  # Prepare for dialing.
  send ATZ\r
  wait OK 10
  if $errlvl != 0 goto error
  dial t5551212
  if $errlvl != 1 goto error

  # We are connected.  Login to the system.
login:
  sleep 3
  wait word: 10
  if $errlvl != 0 goto error
  send PUT_YOUR_PASSWORD_HERE\n
  wait annex 10
  if $errlvl != 0 goto error
  send slip\n

  wait Annex 10
  wait address 1
  wait is 1
  if $errlvl != 0 goto error
  get $remote remote 1
  if $errlvl != 0 goto error

  wait Your 1
  wait address 1
  wait is 1
  if $errlvl != 0 goto error
  get $local remote 1
  if $errlvl != 0 goto error
done:
  print CONNECTED to $remote with address $local
  default
  mode CSLIP
  goto exit
error:
  print error.
exit:

