home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / itrafic.zip / OFF.CMD < prev    next >
OS/2 REXX Batch file  |  1999-11-09  |  1KB  |  80 lines

  1. /**/
  2.  
  3.  i = 0
  4.  l = ''
  5.  retVal = 1
  6.  
  7.  echo = ''
  8.  connected = 0
  9.  
  10.  EOT = '04'x
  11.  ACK = '06'x
  12.  BEL = '07'x
  13.  signal on halt
  14.  signal on error
  15.  signal on syntax
  16.  
  17.  call RxFuncAdd "loadrtn","Nvt","load_routine"
  18.  call loadrtn
  19.  call RxFuncDrop "loadrtn"
  20.  
  21.  share = 'OS2ENVIRONMENT'
  22.  
  23.  hostname = value('stofaloginhost',,share)
  24.  if hostname = ''
  25.  then do
  26.    say 'STOFALOGINHOST setting not found'
  27.    exit(2)
  28.  end
  29.  port = value('stofaloginport',,share)
  30.  if port = ''
  31.  then do
  32.    say 'STOFALOGINPORT setting not found'
  33.    exit(2)
  34.  end
  35.  userId = value('stofaloginuserid',,share)
  36.  if userId = ''
  37.  then do
  38.    say 'STOFALOGINUSERID setting not found'
  39.    exit(2)
  40.  end
  41.  password = value('stofaloginpassword',,share)
  42.  if password = ''
  43.  then do
  44.    say 'STOFALOGINPASSWORD setting not found'
  45.    exit(2)
  46.  end
  47.  
  48.  socket = Telnet(hostname,port)
  49.  
  50.  if socket = ''
  51.    then
  52.        say 'telnet connection failed'
  53.    else
  54.      do
  55.        c = Tput(socket,userId)
  56.        c = Tput(socket,password)
  57.        c = Tput(socket,2)
  58.        say 'Logging out OK!'
  59.        retVal = 0
  60.  
  61.        do forever
  62.          l = Tget(socket)
  63.          select
  64.            when l = EOT then leave
  65.            when l = '' then leave
  66.            otherwise do; end;
  67.          end
  68.        end
  69.      end
  70.  
  71.  call halt
  72.  return
  73.  
  74. halt:
  75.  call Tquit socket
  76.  call RxFuncAdd "droprtn","Nvt","drop_routine"
  77.  call droprtn
  78.  call RxFuncDrop "droprtn"
  79.  exit (retVal)
  80.