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

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