home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
altslp.txt
< prev
next >
Wrap
Text File
|
1994-12-03
|
10KB
|
265 lines
#: 270875 S20/Internet IAK (BP)
18-Nov-94 23:36:13
Sb: Success with Rexx script
Fm: Mike E. Perry 75252,444
To: Orest Skrypuch (Recon) 76672,1273 (X)
This is the script that was written by Iceberg@slip.net. All kudos go to
him. I can vouch that it works for dynamically assigned slip accounts. You
will have to change the information regarding internet service provider,
phone number, user id, and password. Also remember to change modem
instructions from what mine are. I found that the culprit with my attempts
at this script was that I couldn't get past *connect 14400, etc*. This was
caused by an incorrect modem string. This script is also based on not
issuing the *slip* command to your provider to begin TCP/IP. I have used
this script with all the WARP tools including WebExplorer, news, mail,
gopher, ftp, telnet. I get darned good ftp dl's with it. Also this script
parses the "S" before a user's name to get the dynamic address. Don't know
how this works, but you can read it in the attached info. I would never have
come up with this in a kazillion years!!
Again, thanks to Iceberg@slip.net and all the slipnetters for their continued
patience... Iceberg tells me that the most important part of the script is
the first part which assigns the IPs. Good luck, HTH!!
>>>>>>>>>>begin slipnet.cmd>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/*--------------------------------------------------------------------------*/
/* Slipnet.cmd
This rexx script will allow you to use the "Dial Other
Internet Provider' interface to log on to slip.net. slip.net uses the
username to make the slip call, (the "S" that precedes your
username is the call), then sends your dynamic settings in a
single line string. The unmodified annex.cmd sends an
unnecessary slip call, (to Slip Net), and cannot correctly parse the
resulting string. Slipnet.cmd corrects these problems.
This is a modified version of the annex.cmd script found in the /etc
dir of TCPIP.
Good luck! iceberg@slip.net
*/
parse arg interface , dialcmd username password
/*--------------------------------------------------------------------------*/
/* Initialization and Main Script Code */
/*--------------------------------------------------------------------------*/
/* Set some definitions for easier COM strings */
cr='0d'x
crlf='0d0a'x
say ''
say 'Logon Script for OS/2 Warp to Slipnet ',
'(interface' interface')'
/* Prompt for your username, password, and dialing information */
if dialcmd = '' then do
call charout , 'Dial Command: '
parse pull dialcmd
end
if username = '' | username = '*' then do
call charout , 'User Name: '
parse pull username
end
else do
say 'User:' username
end
if password = '' | password = '*' then do
call charout , 'Password: '
password = readpass()
end
/* Flush any stuff left over from previous COM activity */
call flush_receive
/* Reset the modem here */
/* You may need to customize this for your modem make and model */
call lineout , 'Reset modem...'
call send 'ATM0&B1&F1' || cr
call waitfor 'OK', 5 ; call flush_receive 'echo'
if RC = 1 then do
call lineout , 'Modem not resetting... Trying again'
call send '+++'
call waitfor 'OK'
call send 'ATHZ' || cr
call waitfor 'OK', 3
end
/* Dial the remote server */
call charout , 'Now Dialing...'
call send dialcmd || cr
/* Handle login. We wait for the slipnet strings, and
then flush anything else to take care of trailing spaces, etc.. */
call waitfor 'slip.net login:' ; call flush_receive 'echo'
call send username || cr
call waitfor 'Password:' ; call flush_receive 'echo'
call send password || cr
/* Parse the results of the SLIP command (the "S" that precedes your*/
/* username) to determine the correct addresses. */
/* We use the "waitfor_buffer" variable from the waitfor routine */
/* to parse the single line we get from the Annex after */
/* waiting for an appropriate point in the data stream. */
call waitfor '....'
parse var waitfor_buffer '(' a '.' b '.' c '.' d ')' 'to ' e '.' f '.' g '.' h
' b'
annex_address = a||'.'||b||'.'||c||'.'||d
os2_address = e||'.'||f||'.'||g||'.'||h
/* Flush anything else */
call flush_receive 'echo'
/* Now configure this host for the appropriate address, */
/* and for a default route through the Annex. */
say 'Slipnet Connection Established'
say 'From 'username' =' os2_address ', To Slip Net =' annex_address
'ifconfig sl0' os2_address annex_address 'netmask 255.255.255.0'
'route -f add default' annex_address '1'
/* All done */
exit 0
/*--------------------------------------------------------------------------*/
/* send ( sendstring) */
/*..........................................................................*/
/* */
/* Routine to send a character string off to the modem. */
/* */
/*--------------------------------------------------------------------------*/
send:
parse arg sendstring
call slip_com_output interface , sendstring
return
/*--------------------------------------------------------------------------*/
/* waitfor ( waitstring , [timeout] ) */
/*..........................................................................*/
/* */
/* Waits for the supplied string to show up in the COM input. All input */
/* from the time this function is called until the string shows up in the */
/* input is accumulated in the "waitfor_buffer" variable. */
/* */
/* If timeout is specified, it says how long to wait if data stops showing */
/* up on the COM port (in seconds).
*/
/* */
/*--------------------------------------------------------------------------*/
waitfor:
parse arg waitstring , timeout
if timeout = '' then
timeout = 5000 /* L O N G delay if not specified */
waitfor_buffer = '' ; done = -1; curpos = 1
ORI_TIME=TIME('E')
if (remain_buffer = 'REMAIN_BUFFER') then do
remain_buffer = ''
end
do while (done = -1)
if (remain_buffer \= '') then do
line = remain_buffer
remain_buffer = ''
end
else do
line = slip_com_input(interface,,10)
end
waitfor_buffer = waitfor_buffer || line
index = pos(waitstring,waitfor_buffer)
if (index > 0) then do
remain_buffer = substr(waitfor_buffer,index+length(waitstring))
waitfor_buffer = delstr(waitfor_buffer,index+length(waitstring))
done = 0
end
call charout , substr(waitfor_buffer,curpos)
curpos = length(waitfor_buffer)+1
if ((done \= 0) & (TIME('E')>timeout)) then do
call lineout , ' WAITFOR: timed out '
done = 1
end
end
timeout=0
RC=done
return RC
/*--------------------------------------------------------------------------*/
/* readpass () */
/*..........................................................................*/
/* */
/* Routine used to read a password from the user without echoing the */
/* password to the screen. */
/* */
/*--------------------------------------------------------------------------*/
readpass:
answer = ''
do until key = cr
key = slip_getch()
if key \= cr then do
answer = answer || key
end
end
say ''
return answer
/*--------------------------------------------------------------------------*/
/* flush_receive () */
/*..........................................................................*/
/* */
/* Routine to flush any pending characters to be read from the COM port. */
/* Reads everything it can until nothing new shows up for 100ms, at which */
/* point it returns. */
/* */
/* The optional echo argument, if 1, says to echo flushed information. */
/* */
/*--------------------------------------------------------------------------*/
flush_receive:
parse arg echo
/* If echoing the flush - take care of waitfor remaining buffer */
if (echo \= '') & (length(remain_buffer) > 0) then do
call charout , remain_buffer
remain_buffer = ''
end
/* Eat anything left in the modem or COM buffers */
/* Stop when nothing new appears for 100ms. */
do until line = ''
line = slip_com_input(interface,,100)
if echo \= '' then
call charout , line
end
return
>>>>>>>>>>end slipnet.cmd>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ORIGIN:OS2SUP