#!/usr/bin/perl

printf("generating vindex.html  ");

`echo "<!DOCTYPE HTML PUBLIC \\"-//IETF//DTD HTML 2.0//EN\\">" > vindex.html`;
`echo "<HTML><HEAD>" >> vindex.html`;
`echo "<title>Index of Pictures taken with WearComp7 system</title>" >> 
vindex.html`;
`echo "</HEAD>" >> vindex.html`;
`echo "<BODY>" >> vindex.html`;

`echo "<h1>Pictures taken with WearComp7 system</h1>" >> vindex.html`;

#for ($counter=0; $counter<=999; $counter++) {

#while (defined($nextname = <p???????.jpg>)) {
while (defined($nextname = <v???.jpg>)) {

# $filev = sprintf("v%03d.jpg", $counter);
 $filev = $nextname;
# $files = sprintf("s%03d.jpg", $counter);
 $files = sprintf("s%s", $nextname);
 $files =~ s/sv/s/;
# printf("creating html link for file $filev\n");
 printf("creating html link for file $nextname\n");

#`echo "<IMG src=\\"$files\\">" >> vindex.html`;
# `echo "<a href=\\"$filev\\"><IMG src=\\"$files\\"></a>" >> vindex.html`;
 `echo "<a href=\\"$filev\\"><IMG src=\\"$files\\">$filev</a>" >> vindex.html`;

}

`echo "<hr>" >> vindex.html`;
`date >> vindex.html`;
`echo "</BODY>" >> vindex.html`;
`echo "</HTML>" >> vindex.html`;
`echo "" >> vindex.html`;

