home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
isdnpm29.zip
/
toncomp.fnc
< prev
next >
Wrap
Text File
|
1998-01-11
|
6KB
|
179 lines
/*--------------------------------------------------------------------------
toncomp.fnc
2.5.1997 Anpassung an Version 2.8
login compuserve via datex-j
Version 13.11.96
--------------------------------------------------------------------------*/
/***************************************************************************/
call RxFuncAdd 'SysSleep','RexxUtil','SysSleep'
ARG Channel LocalIp HostIp Netmask DefaultIp user pass .
username = X2C(SUBSTR(user,1,LENGTH(user)-2))
password = X2C(SUBSTR(pass,1,LENGTH(pass)-2))
cr = '0d'x
crlf = '0d0a'x
remain_buffer = ''
waitfor_buffer = ''
prompt_vt100='[?25h'
prompt_cept='1A'x
prompt_string=prompt_cept
prompt_string=prompt_vt100
say 'Line ' Channel
say 'LocalIp ' LocalIp
say 'HostIp ' HostIp
say 'Netmask ' Netmask
say 'DefaultIp ' HostIp
say 'UserId ' username
say 'Password ' password
datexj="000327278259"
say "Umgeschaltet in VT100. Anmeldung..."
call SHOWSTATUS channel,"Warte auf Anschlusskennung "
call waitfor "00000" ,20
call send datexj||cr
call SHOWSTATUS channel,"Warte auf Übergabeseite"
call waitfor "seite" ,20
call send "11"
call SHOWSTATUS channel,"Warte auf Verbindungsaufbau"
call waitfor "bindungsaufbau" ,20
call send "#"
/* Handle login. */
call SHOWSTATUS channel,"Warte auf Host Name:"
call waitfor "Host Name:" , 20
call send 'CIS'||cr
call SHOWSTATUS channel,"Warte auf User ID:"
call waitfor "User ID:" , 20
call send username||'/NOINT/GO:PPPCONNECT'||cr
call SHOWSTATUS channel,"Warte auf Password:"
call waitfor "ord:" , 20
call send password||cr
call SHOWSTATUS channel,"Warte auf PPPCONNECT"
call waitfor "PPPCONNECT" , 30
call SHOWSTATUS channel,"Im Internet erfolgreich angekommen"
say 'REXX DATAMODE'
rc = ISDNDATAMODE(Channel)
say 'REXX DATAMODE END '
call SHOWSTATUS channel,"Internet beendet"
exit 0
failure:
say "Mist! Schiefgegangen!"
call ISDNDISCONNECT Channel
exit 1
/*--------------------------------------------------------------------------*/
/* send ( sendstring) */
/*..........................................................................*/
/* */
/* Routine to send a character string off to the modem. */
/* */
/*--------------------------------------------------------------------------*/
send:
parse arg sendstring
call ISDNWRITE channel , sendstring
return
/*----------------------------------------------------------------------*/
/* waitfor( waitforstring , [timeout] ) */
/*......................................................................*/
/* */
/* */
/* */
/*----------------------------------------------------------------------*/
waitfor:
parse arg waitstring , timeout
if timeout = '' then
timeout = 20 /* wait 20 sec */
timeout = timeout * 10 ; /* ISDNREAD returns after 1/10 Sek */
waitfor_buffer = '' ; done = -1 ; curpos = 1
do while (( done = -1) & (timeout > 0))
if (remain_buffer \= '') then do
line = remain_buffer
remain_buffer = ''
end
else do
line = ISDNREAD(Channel)
if Substr(line,1,1)<>'00'x then do
say 'ISDNREAD-Fehler'
signal failure
end
line=Substr(line,2)
end
waitfor_buffer = waitfor_buffer || line
if waitstring>='80'x then
index=1
else
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
timeout = timeout - 1
call SysSleep 0
end
if (timeout = 0 ) then do
say 'WAITFOR : timed out '
done = 1
end
RC = done
return RC
/*----------------------------------------------------------------------*/
/* flush_receive() */
/*......................................................................*/
/* */
/* */
/* */
/*----------------------------------------------------------------------*/
flush_receive:
parse arg echo
/* if echoing the flush - take care of waitfor remainig buffer */
if( echo \= '' ) && (length(remain_buffer) > 0 ) then do
call charout, remain_buffer
end
cx = 20
line = ''
do while (line \= '') & (cx > 0 )
line = ISDNREAD(Channel)
if Substr(line,1,1)<>'00'x then do
say 'ISDNREAD-Fehler'
signal failure
end
line=Substr(line,2)
if echo \= '' then
call charout,line
cx = cx - 1
end
return