Ticket #2111: allow pause in copy/move/delete file operation.
[midnight-commander.git] / maint / dupincludes.pl
blobda8e06e442fa9ffeddc494a1428de904502c32c3
1 #!/usr/bin/env perl
3 # Locate duplicate includes
5 # Copyright (c) 2005, Pavel Roskin
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 use strict;
22 my %sys_includes;
23 my %loc_includes;
25 if ($#ARGV != 0) {
26 print "Usage: dupincludes.pl file\n";
27 exit 1;
30 my $filename = $ARGV[0];
32 if (!open (FILE, "$filename")) {
33 print "Cannot open file \"$filename\"\n";
34 exit 1;
37 foreach (<FILE>) {
38 if (/^\s*#\s*include\s*<(.*)>/) {
39 if (defined $sys_includes{$1}) {
40 print "$filename: duplicate <$1>\n";
41 } else {
42 $sys_includes{$1} = 1;
44 } elsif (/^\s*#\s*include\s*"(.*)"/) {
45 if (defined $loc_includes{$1}) {
46 print "$filename: duplicate \"$1\"\n";
47 } else {
48 $loc_includes{$1} = 1;