3 # Copyright (c) 2005, Pavel Roskin
4 # This script is Free Software, and it can be copied, distributed and
5 # modified under the terms of GNU General Public License, version 2.
7 # Locate duplicate includes
15 print "Usage: dupincludes.pl file\n";
19 my $filename = $ARGV[0];
21 if (!open (FILE
, "$filename")) {
22 print "Cannot open file \"$filename\"\n";
27 if (/^\s*#\s*include\s*<(.*)>/) {
28 if (defined $sys_includes{$1}) {
29 print "$filename: duplicate <$1>\n";
31 $sys_includes{$1} = 1;
33 } elsif (/^\s*#\s*include\s*"(.*)"/) {
34 if (defined $loc_includes{$1}) {
35 print "$filename: duplicate \"$1\"\n";
37 $loc_includes{$1} = 1;