Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6.26
[linux-2.6/openmoko-kernel/knife-kernel.git] / scripts / checkincludes.pl
blob8e6b716c191c67a1b0668caf43a8bf777b271299
1 #!/usr/bin/perl
3 # checkincludes: Find files included more than once in (other) files.
4 # Copyright abandoned, 2000, Niels Kristian Bech Jensen <nkbj@image.dk>.
6 foreach $file (@ARGV) {
7 open(FILE, $file) or die "Cannot open $file: $!.\n";
9 my %includedfiles = ();
11 while (<FILE>) {
12 if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) {
13 ++$includedfiles{$1};
17 foreach $filename (keys %includedfiles) {
18 if ($includedfiles{$filename} > 1) {
19 print "$file: $filename is included more than once.\n";
23 close(FILE);