print $out "</table>\n";
}
@lnks = sort keys %{$backs{indexless $page}};
- if ($doBacksForced or ($doBacks and $#lnks != -1)) {
+ my $backsWasGenerated = ($doBacksForced or ($doBacks and $#lnks != -1)) ? 1 : 0;
+ if ($backsWasGenerated) {
print $out "<a id=\"backs\"></a><table border=1><caption>Backlinks</caption>\n";
my $rel;
foreach my $l (@lnks) {
print $out "</table>\n";
}
print $out "</body></html>\n";
+ return $backsWasGenerated;
}
sub genIndex {
close $fh;
utime $now, $now, $fn;
}
- my @s;
foreach my $pth (keys %mtimes) {
open(my $fh, ">", "$ARGV[1]/$pth.html") or die "$!";
- genHTML $fh, $pth;
+ my $backsWasGenerated = genHTML $fh, $pth;
close $fh;
- @s = stat($pth) or die "$!";
- utime $s[9], $s[9], "$ARGV[1]/$pth.html";
+ my @s = stat($pth) or die "$!";
+ if ($backsWasGenerated) {
+ utime $now, $now, "$ARGV[1]/$pth.html";
+ } else {
+ utime $s[9], $s[9], "$ARGV[1]/$pth.html";
+ }
copy $pth, "$ARGV[1]/$pth.txt" or die "$!";
utime $s[9], $s[9], "$ARGV[1]/$pth.txt";
}