/* Convert MSIE Favorites to HTML page  */
/* Author: Brian D. Jones */
/* Date: 5th Jan 97 */
/* Email: support@jonessoft.co.uk */
/* History: 01 Jul 97 Check for "URL=" since not always last line in file. */
/* 01 Jul 97 Long names which include blanks now supported. */

Say "Content-type: text/html"
Say

Parse Arg Path
if Directory( Path ) = "" Then Do
Say "<HTML><HEAD><TITLE>404 Not Found</TITLE></HEAD>"
Say "<BODY><H1>404 Not Found</H1>The requested path<EM>" Path"</EM>was not found on this server<P></BODY></HTML>"
return
end

call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs

root = Directory()

Do While Pos( "\", root ) > 0
Parse Var root . "\" root
End

Say "<HTML><HEAD><TITLE>"root"</TITLE></HEAD><BODY>"
say '<H1><IMG SRC="/icons/urlfldr.gif" WIDTH=32 HEIGHT=32>'root'</H1><HR>'

call ListDir Path

Say "<HR>"
Say "Created:" date() "at" time()
Say "using Rexx command created by <A HREF=http://www.jonessoft.co.uk/>Brian D. Jones</A>"
Say "</BODY>"

call SysDropFuncs
return

ListDir: Procedure
Arg Path

Say "<DL>"
call SysFileTree Path || '\*.*', 'dirs', 'DO'
do i=1 to dirs.0
If Right( dirs.i, 1) \= '.' Then Do
Line = dirs.i
Do While Pos( "\", line ) > 0
Parse Var line . "\" line
End
say '<DT><H3><IMG SRC="/icons/urlfldr.gif" WIDTH=16 HEIGHT=16>'line'</H3><DD>'

call ListDir dirs.i
Say '</DD></DT>'
End
end

call SysFileTree Path || '\*.url', 'file', 'FO'
do i=1 to file.0
Line = file.i
Do While Lines( Line )
text = Linein( Line )
if Left( Text,4)="URL=" then leave; /* Not always last line. */
End
Call Stream Line, "C", "Close"
Parse Var text "URL=" text
Do While Pos( "\", Line ) > 0
Parse Var Line . "\" Line
End
Line = Strip( Left( Line, Length( Line ) -4 ))
say '<DT><IMG SRC="/icons/url.gif" WIDTH=16 HEIGHT=16><A HREF="'text'">' line '</A></DT>'
end

Say "<P></DL>"
return

The following icons are referenced by the generated html:

blocky