| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
use warnings; |
| 4 |
use strict; |
| 5 |
|
| 6 |
my @files = @ARGV; |
| 7 |
|
| 8 |
my $h; |
| 9 |
|
| 10 |
foreach my $file (@files) { |
| 11 |
$h->{$file} = 1; |
| 12 |
} |
| 13 |
|
| 14 |
foreach my $file (@files) { |
| 15 |
open(my $fh, "<", $file) or die "cannot open < $file: $!"; |
| 16 |
while (<$fh>) { |
| 17 |
chomp; |
| 18 |
if ($_ =~ /\.Xr ((ck|CK)_[a-zA-Z_]+) ([0-9])/) { |
| 19 |
my $name = $1; |
| 20 |
my $section = $3; |
| 21 |
if (!$h->{$name}) { |
| 22 |
print STDERR "$file: ref to missing ${name}($section)\n"; |
| 23 |
} |
| 24 |
} |
| 25 |
} |
| 26 |
close($fh) or die("cannot close $file: $!"); |
| 27 |
} |