#!/usr/bin/perl -w
#
# ls_html for Safari
# Copyright (c) 1999 by Barrie Slaymaker, rbs@telerama.com
#
# You may distribute under the terms of either the GNU General Public
# License or the Artistic License, as specified in the README file.
#
my $result = '' ;
my %dirs ;
for ( @ARGV ) {
opendir( DIR, $_ ) ;
while ( $dir = readdir( DIR ) ) {
next if $dir eq '.' ;
$dir .= '/' if -d "$_/$dir" ;
my $url = $dir ;
my $key = lc( $dir ) ;
$dirs{ $key } = "<A HREF=\"$url\">$dir</A>" ;
}
closedir( DIR ) ;
}
$result = join( "\n", map( $dirs{ $_ }, sort keys %dirs ) ) ;
$title = join( ' ', @ARGV ) ;
print qq{
<HTML>
<HEAD>
<TITLE>$title</TITLE>
</HEAD>
<BODY>
<PRE>
$result
</PRE>
</BODY>
} ;
0 ;