ls_html #3

  • //
  • guest/
  • barrie_slaymaker/
  • safari/
  • src/
  • conf/
  • bin/
  • ls_html
  • View
  • Commits
  • Open Download .zip Download (748 B)
#!/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 ;

# Change User Description Committed
#3 168 Barrie Slaymaker Added YAPC paper, slides
#2 165 Barrie Slaymaker Applied Greg KH's license patch.
#1 162 Barrie Slaymaker First code & documentation checkin