/usr/share/anjuta/tools/find-fixmes.pl is in anjuta-common 2:3.18.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | #!/usr/bin/perl
## find-fixmes.pl
## Copyright (C) Naba Kumar <naba@gnome.org>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU Library General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
my ($project_root) = @ARGV;
if (!defined ($project_root) || $project_root eq "") {
print STDERR "Error: No project\n";
exit(1);
}
if ($project_root !~ /^\//) {
print STDERR "Error: Project root is not absolute path\n";
exit(1);
}
my %data_hr;
process_directory ("", \%data_hr);
sub process_directory
{
my ($dir, $data_hr) = @_;
if ($dir ne "") {
print STDERR "Scanning: $dir\n";
} else {
print STDERR "Scanning: .\n";
}
my (@files, @directories);
if (-f "$project_root/$dir/CVS/Entries") {
open (ENTRIES, "$project_root/$dir/CVS/Entries") or
die "Can not open $project_root/$dir/CVS/Entries for reading";
my @lines = <ENTRIES>;
@lines = sort @lines;
foreach my $line (@lines) {
chomp($line);
if ($line =~ /^\/([^\/]+)\//) {
push @files, $1;
}
}
foreach my $line (@lines) {
chomp($line);
if ($line =~ /^D\/([^\/]+)/) {
push @directories, $1;
}
}
} else {
opendir (ENTRIES, "$project_root/$dir") or
die "Can not open $project_root/$dir for reading";
my @lines = readdir(ENTRIES);
foreach my $line (@lines) {
next if ($line eq "." || $line eq "..");
if (-d "$project_root/$dir/$line") {
push @directories, $line;
} else {
push @files, $line;
}
}
}
foreach my $file (@files) {
my $file_path = "$project_root/$dir/$file";
$file_path =~ s/\/\//\//g;
process_file ($file_path, $data_hr) if (-f $file_path);
}
foreach my $directory (@directories) {
if (-d "$project_root/$dir/$directory") {
if ($dir ne "") {
process_directory ("$dir/$directory", $data_hr);
} else {
process_directory ("$directory", $data_hr);
}
}
}
}
sub process_file
{
my ($path, $data_hr) = @_;
my $content = `cat $path`;
## C/C++ specific search
if ($path =~ /\.(c|cc|cpp|cxx|h|hpp|hxx|hh)$/) {
my @data = $content =~ /(\n|\/\*.*?\*\/|\/\/.*?\n)/sgi;
my $continued = 0;
my $lines = 0;
foreach my $match (@data) {
if ($match eq "\n") {
$continued = 0;
} elsif ($match =~ /\bfixme\b/is) {
print "$path:$lines\n";
$match = "\t$match";
$match =~ s/\n\s*/\n\t/sg;
$match =~ s/\s*$//s;
print "$match\n";
$continued = 1;
} else {
if ($continued == 1 && $match =~ /^(\/\*|\/\/)/) {
$match = "\t$match";
$match =~ s/\n\s*/\n\t/sg;
$match =~ s/\s*$//s;
print "$match\n";
}
}
$lines += $match =~ /(\n)/sg;
}
} else {
my @data = split(/\n/, $content);
my $lines = 0;
foreach my $match (@data) {
if ($match =~ /\bfixme\b/is) {
print "$path:$lines\n";
$match =~ s/^\s*/\t/sg;
print "$match\n";
}
$lines++;
}
}
}
|