home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
wdn.zip
/
WDN.CMD
next >
Wrap
OS/2 REXX Batch file
|
1995-04-20
|
12KB
|
274 lines
/*--------------------------------------------------------------------------*/
/* */
/* OS/2 / WARP REX Driver for IBM TCP/IP version 2.0 / IAK */
/* */
/* WDN.CMD */
/* modified by jerry woolsey */
/* .................................................. */
/* */
/* This is a modification to the annex.cmd supplied with IAK. */
/* I have modified the main routine and the waitfor subroutine. You */
/* need to make three manual changes to this script - */
/* */
/* 1) Insert the initialization string you need (should be the */
/* same as the one you use for your normal terminal program */
/* to log onto WDN. "ATZ" is enough for most. I get a lot */
/* of Carrier drops at 28.8K so I use AT%C0S37=20, which */
/* corrects my problems (caused by my crappy phone line). */
/* */
/* 2) Insert your name and password into the logon input line */
/* below. I've always inserted the full name and password */
/* on one line, so I made the script that way (and it made */
/* the script easier. */
/* */
/* 3) Insert your first name (or whatever WDN uses) as the prompt */
/* the script is looking for before sending the "slip" */
/* command. */
/* */
/* Place the script into c:\tcpip\bin */
/* */
/* Use the following settings in the Dial Other Internet Providers*/
/* setup screen: */
/* 1st page: */
/* Provider Name: wdn.com */
/* Login ID: <blank> */
/* Password: <blank> (uncheck box if you have the new version)*/
/* Nickname: WDN */
/* Phone Number: <blank> */
/* Login script: wdn.cmd atdt620-8900 */
/* Connection type: select button for SLIP */
/* */
/* 2nd page: */
/* Your IP address, Destination IP Address, and Netmask should be */
/* greyed out (left blank) */
/* MTU Size: 1006 */
/* VJ Compression check box - YES */
/* Domain Nameserver: 199.0.216.4 */
/* Your Host Name: <blank> */
/* Your Domain Name: wdn.com */
/* */
/* 3rd page: */
/* All can be left blank - or fill in defaults you want */
/* */
/* 4th page: */
/* Hopefully you know what to fill in here for comm port */
/* Speed should be 57600, 8 bits, no parity */
/* */
/* GOOD LUCK - */
/*--------------------------------------------------------------------------*/
parse arg interface , dialcmd
/*--------------------------------------------------------------------------*/
/* Initialization and Main Script Code */
/*--------------------------------------------------------------------------*/
/* Set some definitions for easier COM strings */
cr='0d'x
crlf='0d0a'x
say ''
say 'WDN - SLIP WDN Example Connection Script ',
'(interface' interface')'
/* 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...'
/* Use your own initialization string */
call send 'ATZ' || 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...'
/* Wait for connection */
call send dialcmd || cr
call waitfor 'CONNECT' ; call waitfor crlf
/* Handle login. We wait for standard strings, and then flush anything */
/* else to take care of trailing spaces, etc.. */
call send cr
call waitfor 'change?' ; call flush_receive 'echo'
call send 'n' || cr
call waitfor '?' ; call flush_receive 'echo'
call send 'n' || cr
call waitfor 'Name?' ; call flush_receive 'echo'
/* Need to modifiy these two lines to you name and password for logon */
/* and name used in prompts */
call send 'jerry woolsey password' || cr
call waitfor 'Jerry?' ; call flush_receive 'echo'
call send 'slip' || cr
call waitfor 'Slip'
call waitfor 'you'
parse var waitfor_buffer . 'server is' a '.' b '.' c '.' d ',' .
wdn_address = a||'.'||b||'.'||c||'.'||d
call waitfor crlf
parse var waitfor_buffer . 'are' a '.' b '.' c '.' d .
os2_address = a||'.'||b||'.'||c||'.'||d
/* Flush anything else */
call flush_receive 'echo'
say 'SLIP Connection Established'
say 'Configuring local address =' os2_address ', wdn =' wdn_address
'ifconfig sl0' os2_address wdn_address 'netmask 255.255.255.0'
'route add default' wdn_address '1'
/* All done */
exit 0
/*--------------------------------------------------------------------------*/
/* send ( sendstring) */
/*..........................................................................*/
/* */
/* Routine to send a character string off to the modem. */
/* NOT MODIFIED */
/*--------------------------------------------------------------------------*/
send:
parse arg sendstring
call slip_com_output interface , sendstring
return
/*--------------------------------------------------------------------------*/
/* waitfor ( waitstring , [timeout] ) */
/*..........................................................................*/
/* (MODIFIED FOR WDN SLIP) */
/* 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 = 1000 /* 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
/* Look for More? or continue prompts during logon - bypass them */
if (pos('More?',waitfor_buffer)>0) then do
call flush_receive 'echo'
waitfor_buffer = '' ; curpos = 1
call send 'n' || cr
end
if (pos('ontinue?',waitfor_buffer)>0) then do
call flush_receive 'echo'
waitfor_buffer = '' ; curpos = 1
call send '' || cr
end
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. */
/* NOT MODIFIED */
/*--------------------------------------------------------------------------*/
readpass:
answer = ''
do until key = cr
key = slip_getch()
if key \= cr then do
answer = answer || key
end
end
say ''
return answer
/*--------------------------------------------------------------------------*/
/* flush_receive () */
/*..........................................................................*/
/* NOT MODIFIED */
/* 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