/*-------------------------------------------------------------------------------------- DIAL4ME.CMD SLIP/PPP script for IBM IAK to XS4ALL.NL in Amsterdam/Zoetermeer version 8 feb 1996 Directory : \TCPIP\BIN De belangrijkste instellingen in "Dial Other Internet Providers" Major settings in "Dial Other Internet Providers" Page 1: Login ID: *user-id* Password: *password* [required] Phone Number: 0206222175 of 0206265060 of 0793611011 of 0206222175;0206265060 Login sequence: dial4me.cmd Page 2: VJ Compression: Marked Domain Nameserver: 193.78.33.42 Your domain name: xs4all.nl Voor meer informatie/for more information: http://www.xs4all.nl/help/os2help/ http://www.xs4all.nl/~ronvwier/OS2/ Na het inloggen op XS4ALL wordt START4ME.CMD gestart waarin kan worden geregeld dat programma's aktief worden gemaakt als de verbinding werkt. After the login START4ME.CMD will be activated which you can use to activate programs that need a running connection. Ron van Wier (ronvwier@xs4all.nl) http://www.xs4all.nl/~ronvwier/ -------------------------------------------------------------------------------------- */ call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' call SysLoadFuncs parse arg interface if left(interface,1) = 's' then slip = 1 else slip = 0 /* Get info from INI */ ini = value('ETC',,'OS2ENVIRONMENT') || '\TCPOS2.INI' provid = sysini(ini,'CONNECTION','CURRENT_CONNECTION') username = strip(sysini(ini,provid,'LOGIN_ID'),,x2c('00')) password = strip(sysini(ini,provid,'PWD'),,x2c('00')) phone_number = strip(sysini(ini,provid,'PHONE_NUMBER'),,x2c('00')) prov_naam = strip(sysini(ini,provid,'PROVIDER'),,x2c('00')) cr='0d'x lf='0a'x crlf=cr || lf /* The phone number can be 'nr1;nr2;...' */ parse var phone_number nummer.1 ';' nummer.2 ';' nummer.3 ';' nummer.4 ';' nummer.5 ';' nummer.6 /* Init modem */ echo = 0 say 'Modem init' call send 'ATZ' || cr call receive 'WAIT',10,'OK' /* Call to all given numbers until connection */ numtel = 0 do until answer = 'CONNECT' numtel = numtel+1 if nummer.numtel = '' then numtel = 1 call receive 'FLUSH',1 say 'Dialing' nummer.numtel call send 'ATDT' || nummer.numtel || cr answer = receive('WAIT',120,'CONNECT','BUSY','NO CARRIER','NO DIALTONE','NO ANSWER') select when answer = 'BUSY' then say 'Busy, busy, busy...' when answer = 'NO CARRIER' then say 'Connection failed...' when answer = 'NO ANSWER' then say 'No modem answering...' when answer = 'NO DIALTONE' then say 'No dialtone...' otherwise nop end /* Wait a sec before redialing */ if answer <> 'CONNECT' then Call SysSleep 1 end /* Connection at last! */ call beep 262,10 call beep 32000,50 call beep 330,10 call beep 32000,50 call beep 392,10 speed = receive('UNTIL',10,cr) say answer speed echo = 1 /* wait for login prompt */ call receive 'WAIT',60,'ogin:' /* Activate the autostart script */ say 'REXX file START4ME.CMD has been activated' '@start /I /C /WIN start4me' if slip then do /* login with Dname */ call send 'D' || username || cr call receive 'WAIT',60,'assword:' call send password || cr /* Wait for our IP address */ call receive 'WAIT',60,'address' os2_address = strip(receive('UNTIL',5,cr)) os2_address = strip(os2_address,,lf) provider_address = "193.78.33.33" /* Configure SLIP with local address, provider address and gateway */ 'ifconfig lo' os2_address 'ifconfig' interface os2_address provider_address 'netmask 255.255.255.0' 'route -f add default' provider_address '1' end else do call send 'P' || username || cr call receive 'WAIT',60,'assword:' call send password || cr end say exit 0 /*--------------------------------------------------------------------------*/ /* Routine to send a character string to the modem. */ /*--------------------------------------------------------------------------*/ send: parse arg sendstring if slip then call slip_com_output interface , sendstring else call ppp_com_output interface , sendstring return /*--------------------------------------------------------------------------*/ /* Routine to receive a string from the modem */ /*--------------------------------------------------------------------------*/ receive: parse arg command , receive_timeout , parm.1 , parm.2 , parm.3, parm.4, parm.5, parm.6 parm.7 = '' if receive_buffer = 'RECEIVE_BUFFER' then receive_buffer = '' select when command = 'FLUSH' then do do until line = '' if slip then line = slip_com_input(interface,,receive_timeout*1000) else line = ppp_com_input(interface,,receive_timeout*1000) if echo then call charout , line end receive_buffer = '' end when command = 'UNTIL' then do call time 'R' do until receive_pos > 0 | time('E') > receive_timeout if slip then data = slip_com_input(interface,,100) else data = ppp_com_input(interface,,100) if echo then call charout , data receive_buffer= receive_buffer || data receive_pos = pos(parm.1,receive_buffer) end if receive_pos < 1 then do say 'Expected string' parm.1 'not received within' timeout 'seconds' exit -1 end receive_before = left(receive_buffer,receive_pos-1) receive_buffer = delstr(receive_buffer,1,receive_pos+length(parm.1)-1) return receive_before end when command = 'WAIT' then do call time 'R' do until receive_pos > 0 | time('E') > receive_timeout if slip then data = slip_com_input(interface,,100) else data = ppp_com_input(interface,,100) if echo then call charout , data receive_buffer= receive_buffer || data x = 1 do until parm.x = '' | receive_pos > 0 receive_pos = pos(parm.x,receive_buffer) if receive_pos < 1 then x = x + 1 end end if receive_pos < 1 then do call charout , 'Expected string(s) ' x = 1 do until parm.x = '' call charout , parm.x || ', ' x = x + 1 end say 'not received within' receive_timeout 'seconds' exit -1 end receive_found = parm.x receive_buffer = delstr(receive_buffer,1,receive_pos+length(parm.x)-1) return receive_found end end return /*-------------------------------- end DIAL4ME ------------------------------------------------*/