open INFILE,"version.cfg";
while (<INFILE>)
{
	s/\n//g;
	if (m/CLAM_VERSION *= */)
	{
		$clam_version = $';
	}
	if (m/DOC_REVISION *= */)
	{
		$doc_revision = $';
	}
}
close INFILE;

open INFILE,"documentation-in.html";
open OUTFILE,">documentation.html";

while (<INFILE>)
{
	if (m/href="(.*?)">/i)
	{
		$fn = $1;
		if (! ($fn =~ m/^http/))
		{
			$filesize = `du -sH $fn 2>&1`;
			if ($filesize =~ m/No such/g) { 
				$filesize = "<B>Error: Missing $fn</B>"; 
				print OUTFILE "ERROR: Missing $val\n";
			}
			else {
				($filesize) = split "\t",$filesize;
			}
		}
	}
	s/\$CLAM_VERSION/$clam_version/g;
	s/\$DOC_REVISION/$doc_revision/g;
	s/\$FILESIZE/$filesize/g;
	print OUTFILE $_;
}

close INFILE;
close OUTFILE;
