home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 January / PCO0197.ISO / filesbbs / os2 / isdnpm27.arj / LOGINC.FNC < prev    next >
Encoding:
Text File  |  1996-06-23  |  3.5 KB  |  112 lines

  1. /***************************************************************************/
  2. call RxFuncAdd 'SysSleep','RexxUtil','SysSleep'
  3.  
  4. ARG Channel LocalIp HostIp Netmask DefaultIp
  5.  
  6. cr   = '0d'x
  7. crlf = '0d0a'x
  8. remain_buffer  = ''
  9. waitfor_buffer = ''
  10.  
  11. say 'Line       ' Channel
  12. say 'LocalIp    ' LocalIp
  13. say 'HostIp     ' HostIp
  14. say 'Netmask    ' Netmask
  15. say 'DefaultIp  ' HostIp
  16.  
  17. CompId = "222333,4455"
  18. CompPw = "MEIN PASSWORD"
  19.  
  20.  
  21. call SysSleep 2
  22. rc = ISDNWRITE(Channel,cr)
  23. call waitfor  "Host Name:" , 10
  24. rc = ISDNWRITE(Channel,'CIS'||cr)
  25. call waitfor  "User ID:" , 10
  26. rc = ISDNWRITE(Channel,CompId||'/GO:PPPCONNECT'||cr)
  27. call waitfor  "ord:" , 10
  28. rc = ISDNWRITE(Channel,CompPw||cr)
  29. call waitfor  "moment" , 10
  30. rc = ISDNWRITE(Channel,cr)
  31.  
  32. /* must not be changed ! */
  33.  
  34. say 'REXX DATAMODE'
  35. rc = ISDNDATAMODE(Channel)
  36. say 'REXX DATAMODE END '
  37.  
  38.  
  39. exit 0
  40.  
  41. /*----------------------------------------------------------------------*/
  42. /*  waitfor( waitforstring , [timeout] )                                */
  43. /*......................................................................*/
  44. /*                                                                      */
  45. /*                                                                      */
  46. /*                                                                      */
  47. /*----------------------------------------------------------------------*/
  48.  
  49. waitfor:
  50.  
  51.     parse arg waitstring , timeout
  52.     if timeout = '' then
  53.         timeout = 20        /* wait 20 sec */
  54.  
  55.     timeout = timeout * 10 ;    /* ISDNREAD returns after 1/10 Sek */
  56.  
  57.     waitfor_buffer = '' ; done = -1 ; curpos = 1
  58.     do while (( done = -1) & (timeout > 0))
  59.         if (remain_buffer \= '') then do
  60.             line = remain_buffer
  61.             remain_buffer = ''
  62.         end
  63.         else do
  64.             line = ISDNREAD(Channel)
  65.             if Substr(line,1,1)<>'00'x then do
  66.               say 'ISDNREAD-Fehler'
  67.               signal failure
  68.             end
  69.             line=Substr(line,2)
  70.         end
  71.         waitfor_buffer = waitfor_buffer || line
  72.         index = pos(waitstring,waitfor_buffer)
  73.         if (index > 0 ) then do
  74.             remain_buffer = substr(waitfor_buffer,index+length(waitstring))
  75.             waitfor_buffer = delstr(waitfor_buffer,index+length(waitstring))
  76.             done = 0
  77.         end
  78.         call charout,substr(waitfor_buffer,curpos)
  79.         curpos = length(waitfor_buffer)+1
  80.         timeout = timeout - 1
  81.     end
  82.     if (timeout = 0 ) then do
  83.         say 'WAITFOR : timed out '
  84.         done = 1
  85.     end
  86.     RC = done
  87. return RC
  88.  
  89. /*----------------------------------------------------------------------*/
  90. /*  flush_receive()                                                     */
  91. /*......................................................................*/
  92. /*                                                                      */
  93. /*                                                                      */
  94. /*                                                                      */
  95. /*----------------------------------------------------------------------*/
  96. flush_receive:
  97.  
  98.     parse arg echo
  99.     /* if echoing the flush - take care of waitfor remainig buffer */
  100.     if( echo \= '' ) && (length(remain_buffer) > 0 ) then do
  101.         call charout, remain_buffer
  102.     end
  103.     cx = 20
  104.     line = ''
  105.     do while (line \= '') & (cx > 0 )
  106.         line = ISDNREAD(Channel)
  107.         if echo \= '' then
  108.             call charout,line
  109.         cx = cx - 1
  110.     end
  111.     return
  112.