| GetOptions("basedir=s" => \$basedir) |
| or die("Cannot parse command line arguments\n"); |
| my ($where, $what, $error) = @_; |
| print "$where: $error: $what\n"; |
| open my $fh, "<", "$basedir/$page.txt"; |
| my ($section) = ($firstline =~ /.*\((\d)\)$/); |
| while (s/linkgit:((.*?)\[(\d)\])//) { |
| my ($target, $page, $section) = ($1, $2, $3); |
| report($where, $target, "nongit link"); |
| if (! -f "$basedir/$page.txt") { |
| report($where, $target, "no such source"); |
| $real_section = grab_section($page); |
| if ($real_section != $section) { |
| "wrong section (should be $real_section)"); |
| lint($File::Find::name) if -f && /\.txt$/; |
| find({ wanted => \&lint_it, no_chdir => 1 }, $basedir); |