[BACK]Return to checkincludes.pl CVS log [TXT][DIR] Up to [Development] / linux-2.4-xfs / scripts

File: [Development] / linux-2.4-xfs / scripts / checkincludes.pl (download)

Revision 1.1, Wed Dec 31 00:54:49 2003 UTC (13 years, 10 months ago) by cattelan
Branch: MAIN
CVS Tags: HEAD

Initial Import 2.4.24pre2

#!/usr/bin/perl
#
# checkincludes: Find files included more than once in (other) files.
# Copyright abandoned, 2000, Niels Kristian Bech Jensen <nkbj@image.dk>.

foreach $file (@ARGV) {
	open(FILE, $file) or die "Cannot open $file: $!.\n";

	my %includedfiles = ();

	while (<FILE>) {
		if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) {
			++$includedfiles{$1};
		}
	}
	
	foreach $filename (keys %includedfiles) {
		if ($includedfiles{$filename} > 1) {
			print "$file: $filename is included more than once.\n";
		}
	}

	close(FILE);
}