3 # checkincludes: Find files included more than once in (other) files.
4 # Copyright abandoned, 2000, Niels Kristian Bech Jensen <nkbj@image.dk>.
6 #if 0 // 5 errors and 2 warnings are inaccaptable for elogind - See PerlCritic.
7 # foreach $file (@ARGV) {
8 # open(FILE, $file) or die "Cannot open $file: $!.\n";
10 # my %includedfiles = ();
13 # if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) {
14 # ++$includedfiles{$1};
17 # foreach $filename (keys %includedfiles) {
18 # if ($includedfiles{$filename} > 1) {
19 # print "$file: $filename is included more than once.\n";
29 foreach my $file (@ARGV) {
30 my %includedfiles = ();
32 open(my $FILE, "<", $file) or die "Cannot open $file: $!.\n";
34 if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) {
40 foreach my $filename (keys %includedfiles) {
41 if ($includedfiles{$filename} > 1) {
42 print "$file: $filename is included more than once.\n";