home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / listnews.cmd < prev    next >
OS/2 REXX Batch file  |  1997-09-25  |  894b  |  39 lines

  1. /* List newsgroups from Netscape news.rcg file 
  2.    Author: Kenneth Porter (shiva@well.com)
  3.    Redistributable with attribution.
  4. */
  5.  
  6. parse arg filename
  7.  
  8. if '' == filename then do
  9.   say 'usage: ListNews news.rcg'
  10.   return 1
  11. end
  12.  
  13. call stream filename, C, 'query exists'
  14. if result = "" then do
  15.   say 'File "' || filename || '" not found'
  16.   say 'usage: ListNews news.rcg'
  17.   return 1
  18. end
  19.  
  20. do until lines(filename) == 0
  21.   line = linein(filename)
  22.   level = substr(line,1,1)
  23.   component = substr(line,2)
  24.   /* look for lines that start with a digit followed by a letter */
  25.   if (datatype(level,'N') & datatype(substr(component,1,1),'M')) then do
  26.     j = 1 + level
  27.     group.j = component
  28.     fullgroup = group.1
  29.     do i = 2 to j
  30.       fullgroup = fullgroup || '.' || group.i
  31.     end
  32.     call lineout ,fullgroup
  33.   end
  34. end
  35.  
  36. call stream filename, 'c', 'close'
  37.  
  38. exit 0
  39.