#!/usr/local/bin/perl
#
# mk_overview creates an "overview" file of a directory. Each file ending in
# .html is included in the overview. File size and last access date are given.
#
# only files ending in *.html are listed. Only files of >0 bytes size are
# listed. A directories contents is not listed if the directory contains a
# .ignoredir file
#
# per default, the "current directory" is scanned; this is superseded by the
# first command line argument, if any.
# per default, a file "overview.html" is generated in the directory to be
# scanned; this is superseded by the second argument, if any
#
# The files are scanned for "overview directives"; these are comments of the
# form
#
# directives are
# HIDDEN -- don't include this file in the overview
# DATE(text) -- "last changed" date string
# SIZE(text) -- "current size" string
# DESC(text) -- description of the file (default: empty string)
# NAME(text) -- name to be used (default: file name)
#
# Revision History:
# 02.04.95: wrote it down, and trashed 7 files in the process.
# 03.04.95: added recursive directory
# 04.06.98: re-visit, parameters changed
# TODO: faster (only one grep-walk per file)
$author_email = 'mfx@pobox.com';
#---------------------------------------------------------------------------
($today_mon,$today_day,$today_year) = `date +%m:%d:%y` =~ /(.*):(.*):(.*)/;
#---------------------------------------------------------------------------
sub printHeader {
print OUT <<"EndOfHeader";
\n";
&printDir();
}
$url=$oldurl;
$dir=$olddir;
print "chdir back to $dir\n";
chdir($dir); # the dir might be a link, therefore full name instead of ..
} else {
&printFile();
}
}
}
}
print OUT "\n
\n";
}
#---------------------------------------------------------------------------
if ($#ARGV >= 0) {
$dir = $ARGV[0];
} else {
$dir = "/usr/local/WWW/mfx.dasburo.com/";
}
if ($#ARGV >= 1) {
$url = $ARGV[1];
} else {
$url = "http://mfx.dasburo.com/";
}
if ($#ARGV >= 2) {
$out = $ARGV[1];
} else {
$out = "overview.html";
}
if ($#ARGV > 3) {
print "ignoring extraneous arguments\n";
}
# print "output file:",$out,"\n";
chdir($dir) || die "can't chdir to $dir";
open(OUT,">$out") || die "can't open $out";
&printHeader();
&printDir();
&printFooter();
close(OUT);