home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / networking / worldwideweb / mosaic_1.2_as225r2 / rexx / add-hotlist.www next >
Text File  |  1994-07-04  |  1KB  |  55 lines

  1. /*
  2.  * A QAD hack to keep a hotlist for Amiga Mosaic 1.2.
  3.  *
  4.  * Copyright 1994, Mike W. Meyer
  5.  */
  6.  
  7. /* Argument parsing - what there is of it */
  8. parse arg infile outfile
  9. if infile = "" then infile = "envarc:Mosaic/hotlist.html"
  10. if outfile = "" then outfile = "env:Mosaic/hotlist.html"
  11.  
  12. /* Get the line to be added */
  13. options results
  14. 'get url'
  15. url = result
  16. 'fetch title'
  17. new = '<MENU><A HREF="'url'">'result'</A>'
  18.  
  19. /* Get my two file handles */
  20. nofile = ~open(infile, infile, 'Read')
  21. if ~open(outfile, outfile, 'Write') then exit 10
  22.  
  23. /*
  24.  * Copy (or create) the header. Everything up to the first blank line
  25.  * in the input file is header, and left alone.
  26.  */
  27. if nofile then do
  28.     call writeln outfile, "<HTML><HEAD><TITLE>Hotlist</TITLE></HEAD>" ,
  29.         "<BODY><H1>Pages of interest</H1><MENU>"
  30.     call writeln outfile, ""
  31.     end
  32. else
  33.     do until line = ""
  34.         line = readln(infile)
  35.         call writeln outfile, line
  36.         end
  37.  
  38. /* Add the new line */
  39. call writeln outfile, new
  40.  
  41. /* Now copy the rest */
  42. if nofile then
  43.     call writeln outfile, "</MENU></BODY></HTML>"
  44. else
  45.     do until eof(infile)
  46.         line = readln(infile)
  47.         call writeln outfile, line
  48.         end
  49.  
  50. /* Clean up, and copy outfile back to infile */
  51. call close outfile
  52. call close infile
  53. address command 'copy' outfile infile
  54. exit 0
  55.