/usr/share/codeblocks/lexers/lexer_perl.sample is in codeblocks-common 10.05-2.
This file is owned by root:root, with mode 0o644.
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 | # A grep in perl - found somewhere in the depth of the internet...
#
# Usage: perlgrep.pl [OPTION]... PATTERN [FILE]...
# OPTIONS:
# -r Recursive search
# -i Case insensitive
use Getopt::Std;
use File::Find;
if ($#ARGV < 1) {
&showUsage();
}
else
{
getopts('ir'); # Get the options
# this assumes that all the options are before the REGEX
while ($ARGV[0] =~ /^-/) { shift @ARGV } # Remove options from @ARGV array
if ($#ARGV > 1) { $SHOW_FILENAME = 1 }
$REGEX = shift @ARGV;
$REGEX =~ s/^\///;
$REGEX =~ s/\/$//;
for ($i=0; $i <= $#ARGV; $i++) {
if ($opt_r && -d $ARGV[$i]) {
find(\&wanted, $ARGV[$i]);
}
else {
if (-d $ARGV[$i]) {
print "$0: $ARGV[$i] is a directory.\n";
}
if (-f $ARGV[$i]) { perlGrep($REGEX, $ARGV[$i]) }
}
}
}
sub showUsage {
print <<END_OF_PRINT
Usage: perlgrep.pl [OPTION]... PATTERN [FILE]...
OPTIONS:
-r Recursive search
-i Case insensitive
END_OF_PRINT
}
sub wanted {
&perlGrep($REGEX, $File::Find::name);
}
sub perlGrep {
$r = shift;
$f = shift;
$r =~ s/^m\///;
$r =~ s/^\///;
$r =~ s/\/$//;
#$f = "/usr/include/$f";
if (-T "$f") {
open(FILE, $f) || warn "Cannot open $f: $!";
while (<FILE>) {
if (/$r/) {
if ($SHOW_FILENAME) { print $f, ":" }
print;
}
}
}
close(FILE);
}
|