#!/usr/local/bin/perl
# ~/bin/lisa2html.p
#
# this is tuned for SUNOS!
#
# usage :
# ls -lisa (files) | lisa2html.p title="Holiday" path="pics/" > file.html
# creates an html document which lists the files and their sizes
# David J.C. MacKay (c) 1997
print STDERR "recommend using album.p instead\n" ;
$path=""; $title="";
# How to override with command line
eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift;
print "
\n$title\n\n$title
\n\n" ;
while ( <> ) {
s/^\s*// ;
if ( ! (/^total/) ) {
@a = split ;
# if this is sunos, then we have:
# 0num, 1size, 2permis, 3n, 4owner, 5size, 6dat, 7dat, 8dat, 9file
# under linux,
# 478191 57 -rw-r--r-- 1 mackay other 57992 Apr 25 21:40 grab1.jpg
# 0 1 2 3 4 5 6size 7dat 8 9time 10file
if ($#a > 9) {
$name = $a[10] ;
print STDERR "l" ;
} else {
$name = $a[9] ;
print STDERR "s" ;
}
$name =~ s/\*// ; # remove executable tag
print "- $name ( $a[1] K) :" ;
print "\n" ;
}
}
print "
\n";
#
# Other users should put their personal footer here.
#
print "
\nDavid MacKay <mackay\@mrao.cam.ac.uk>\n";
print "\n\n\n \n" ;
print STDERR "\n" ;