#!/usr/sbin/dip

# Here is a dynamic script that I obtained from our ftp server (and slightly
# modified to work with my modem), along with a shell script I wrote to
# grab the assigned IP number for this call and place it into /etc/hosts.
# Hope this helps a few people out:)
# - Blair Sundberg
	#
	# Connection script for dynamic CSLIP
	# Jason Wessel
	# jwessel@uiuc.edu
	# modified for Intel modem and my machine

# I'd recommend, that the login negotiation is done not with
# 8,N,1 as this script suggests, but with 7,E,1 - and only
# after the login (i.e. ASCII) negotiations are over, and
# it's about time to start SLIP protocol, change the line
# parameters to 8,N,1.
# - Uri Blumenthal <uri@watson.ibm.com>

main:
  get $mtu 1500
	# Ip number of the slip router
	# Used for the point to point type connection
  get $remote xxx.xxx.xx.x
        # Set the desired serial port and speed.
	# Com2 is cua1
  port cua1
        # Works well with my 14400 Intel Fax Modem
  speed 38400
  parity N
  databits 8
  stopbits 1
        # Reset the modem and terminal line.
  flush
  send \r\n\r\n
	# Initialization for the Supra Fax Modem You will have to change 
	# this to match what type of modem you have
  send ATZ\r
  wait OK 2
  send AT&c1\r
  wait OK 2
  if $errlvl != 0 goto error
	# Niffty redial when busy
redial:
	# Dial our slip server from local phone
  # Uncomenet the sleep line if you are having problems with dial speed 
  # sleep 3 
  send atdtxxxxxxx\r
  wait BUSY 14
  if $errlvl == 0 goto redial
  	flush
  	wait CONNECT 60
  if $errlvl != 0 goto error

        # We are connected.  Login to the system.
login:
   sleep 3
   wait sername: 10
   if $errlvl != 0 goto error

        # REPLACE YOURLOGINNAME with your login name.

        send YOURLOGINNAME\r
	wait ord: 5
   if $errlvl != 0 goto error

        # REPLACE YOURPASSWORD with your password.

        send YOURPASSWORD\r
	sleep 3
	send slip\r 
#	send default\r
	wait is 30
	get $local remote
   if $errlvl != 0 goto error
done:
   default
   print CSLIP to $remote with address $local 
   mode CSLIP
   goto exit
error:
   print SLIP to $remote failed.
exit:

