home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / a-kwic / examples / aminet-short.rexx < prev    next >
OS/2 REXX Batch file  |  1994-02-07  |  2KB  |  59 lines

  1. /*
  2.  * aminet.rexx - Generate an inputfile for loaddb from "Aminet" CD listings
  3.  *
  4.  * $Id: aminet-short.rexx 1.1 1994/02/08 13:32:12 D_Lowrey Exp $
  5.  *
  6.  *      Syntax: rx aminet-short.rexx AMINET_0693:I_AMINET out-file
  7.  *
  8.  * This ARexx program generates LoadDB input from the I_AMINET short
  9.  * listing file on the Aminet CD-ROM from Walnut Hills.
  10.  *
  11.  * It should also work on the LONG listing file that you can FTP from Aminet.
  12.  */
  13.  
  14. directory = ""
  15. parse arg infile outfile
  16.  
  17. if ~open('Input', strip(infile), "Read") then do
  18.     say "Cant open input file==>'" || infile
  19.     exit 20
  20. end
  21.  
  22. if ~open('Output', strip(outfile), "Write") then do
  23.     say "Cant open output file==>'" || outfile
  24.     exit 20
  25. end
  26.  
  27. do while ~eof('Input')
  28.     line = readln('Input')
  29.     if substr(line,1,6) = "======" then
  30.         iterate
  31.     if line = "" then
  32.         iterate
  33.     
  34.     if datatype(substr(line,1,1), 'A') then do
  35.     
  36.         if substr(line,1,10) = 'Directory ' then do
  37.             parse var line . directory .
  38.             directory = strip(directory)
  39.             say "Processing directory: " directory
  40.             parse var directory . "/" dir1 "/" dir2 "/" dir3
  41.             iterate
  42.         end
  43.         
  44.         parse var line title contents
  45.         title = strip(title)
  46.         contents = strip(contents)
  47.         r=writeln('Output', "#R")
  48.         r=writeln('Output', "#H " || title )
  49.         r=writeln('Output', "#K" title dir1 dir2 dir3)
  50.         r=writeln('Output', "#K pgm/" || title)
  51.         r=writeln('Output', "#T")
  52.         r=writeln('Output', "#T" || directory || "/" || title)
  53.         r=writeln('Output', "#T")
  54.         r=writeln('Output', contents)
  55.     end
  56. end
  57. r=close('Input')
  58. r=close('Output')
  59.