#
# ReadMe.HowTo	For the absolute beginner I'll try to explain the way
#		I  developed  my own  dip script,  depending  on  the
#		output my host does.
#
#
# Version:	@(#)./samples/ReadMe.HowTo	1.01	23.April.1995
#
#
# Author:	Joachim Bartz, <injb@sun.rz.tu-clausthal.de>
#
#		There have been so many changes to get  dip work under
#		BSD...   So I believe, you can call me an author, too.
#		Please read the  ReadMe  file and the man page to know
#		what, when, why.
#
#
#		This program is free software; you can redistribute it
#		and/or  modify it under  the terms of  the GNU General
#		Public  License as  published  by  the  Free  Software
#		Foundation;  either  version 2 of the License, or  (at
#		your option) any later version.
#
#		This program is  distributed in the  hope that it will
#		be useful, but WITHOUT ANY WARRANTY;  without even the
#		implied warranty of MERCHANTABILITY  or  FITNESS FOR A
#		PARTICULAR  PURPOSE.    See  the  GNU  General  Public
#		License for more details.
#
#		You  should have received  a copy  of the  GNU General
#		Public License along with this program;  if not, write
#		to the
#			Free Software Foundation, Inc.
#			675 Mass Ave
#			Cambridge, MA 02139, USA
#

For the absolute beginner I'll try to explain the way I developed my
own dip script, depending on the output my host does.


First the circumstances given on my system:

/etc/hosts contains only one line:
	127.0.0.1 localhost
So no other addresses are given at startup.


OK, here is the plain output from my host.  For easy referece I'll add
line numbers:

	1: Host:
	2: Login:
	3: Password:
	4: My IP is: 139.174.8.18
	5: Your IP is: 139.174.8.176
	6: Netmask is: 255.255.255.0
	7: starting SLIP...

And that's all.

After dialing and getting a CONNECT, the host system asks me, what I
want to do.  This is line 1.

If I only want to get a non-SLIP connection (logging in using a simple
terminal program like minicom) I can simply enter the name of the
desired system (for example I can enter the word "sun" and login
there).  But if I want to get a SLIP connection, I have to enter the
word "slip" followed by a carriage return.

To get SLIP access, I have to login with my personal account and
password, each followed by carriage return, too.
These literals are send, when the strings given in line 2 and 3 are
received.

If login is complete, the host sends the string from line 4.  Because
of this host has four modem lines, I can get different IPs every time
for the host and for myself! So I have to take the given IPs and put
then in the dip variables $rmtip and $locip.

Parsing the netmask (line 6) may be omited (it's the same as the dip
default).

As next, the host sends the string from line 7.  This shows the
script, everything is all right and that we can start our SLIP daemon
now, because the remote site is already up and waiting for ip packets.

The last command before becoming a daemon is "default".  I have to use
it, because the new established connection is my default route.
Please remember, my system is stand alone and does not know anything
from outer space and networks.

My host starts its SLIP server always in auto mode, so I can simply
say "mode CSLIP", maybe you have to parse more and other output to
find the right protocol to use.

After (or better while) executing the "mode CSLIP" command, dip
terminates and leaves a dip daemon running with an own pid.  And that
was all the main work to do.  My first version of this script you can
see below (telephone number and personal literals changed):

	start:
		port ttyv01
		speed 57600
		reset
		init ATE0L2M1X7&K4
	dial_again:
		dial TELEPHONE-NUMBER
		wait 60 CONNECT
		if $errlvl != 1 goto dial_again
		wait 10 Host:
		if $errlvl != 1 goto error
		send slip\n
		wait 10 Login:
		if $errlvl != 1 goto error
		send MYACCOUNT\n
		wait 10 Password:
		if $errlvl != 1 goto error
		send MYPASSWORD\n
		wait 10 My\sIP\sis:
		if $errlvl != 1 goto error
		get $rmtip remote 10
		wait 10 Your\sIP\sis:
		if $errlvl != 1 goto error
		get $locip remote 10
		wait 10 starting\sSLIP...
		if $errlvl != 1 goto error
		default
		mode CSLIP
		goto exit
	error:
		print Error...
	exit:
		print Exiting!
		reset

The next work was to make the script more save and verbose, to show
every state of processing, because if something goes wrong, I want to
see what when and why this happened.

So, I think, that was it.  Hope, it help a bit if you don't know how
to start.
