home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / bos225b2.zip / logresolv.cmd < prev    next >
OS/2 REXX Batch file  |  1999-09-09  |  1KB  |  52 lines

  1. /*
  2.  *  Resolv IP addresses in logfile
  3.  *  REXX script written by Michael Reinsch <mr@uue.org>
  4.  *
  5.  *  this is freeware - NO WARRANTY.
  6.  *
  7.  *  it requires: host.exe
  8.  *               rxqueue.exe
  9.  *
  10.  *  recommanded: emxload.exe from EMX dev. package to load host.exe
  11.  *  (simply remove 'emxload host' in the script if you don't have it)
  12.  */
  13.  
  14. parse arg infile outfile
  15.  
  16. '@echo off'
  17.  
  18. if infile = '' | outfile = '' then do
  19.   say 'syntax: logresolv.cmd <in-logfile> <out-logfile>'
  20.   return 1
  21. end
  22.  
  23. 'rxqueue /clear'
  24. 'emxload host'
  25.  
  26. do while Lines(infile)
  27.   line = LineIn(infile)
  28.   parse var line ip entry
  29.   parse var ip x1 '.' x2 '.' x3 '.' x4
  30.   if DataType(x1, 'Number') & DataType(x2, 'Number') & DataType(x3, 'Number') & DataType(x4, 'Number') then do
  31.     call CharOut, 'resolving ' ip
  32.     if cache.x1.x2.x3.x4 \= 'CACHE.'x1'.'x2'.'x3'.'x4 then
  33.       hostname = cache.x1.x2.x3.x4
  34.     else do
  35.       'host' ip ' | rxqueue /fifo'
  36.       test = LineIn("QUEUE:")
  37.       parse var test ip2 ' = ' hostname
  38.       cache.x1.x2.x3.x4 = hostname
  39.     end
  40.     if hostname \= '' then do
  41.       say ' =>' hostname
  42.       ip = hostname
  43.     end
  44.     else
  45.       say ' - not found'
  46.   end
  47.   else
  48.     say 'not resolving:' ip
  49.   call LineOut outfile, ip entry
  50. end
  51.  
  52.