1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

rkeywordgrep

This commit is contained in:
psyc://psyced.org/~lynX 2009-12-28 04:29:22 +01:00
parent 00713a840e
commit b00a28cbfa

42
utility/rkeywordgrep Executable file
View file

@ -0,0 +1,42 @@
#!/usr/bin/perl
#
# recursive PSYC keyword (methods, variables) collector --lynx98
# you may like how it looks after a subsequent sort
# see also http://about.psyc.eu/Rename
require 'find.pl';
$flags = '';
$flags = shift if $ARGV[0] =~ /^-/;
$verbose = $flags !~ /s/;
$|=1;
&find($#ARGV >= 0 ? @ARGV : '.');
print STDERR '=' x 78, "\n" if $verbose;
exit;
sub wanted {
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= lstat;
return unless /\.[chi]$/ or /\.gen$/;
return if -d _;
# return unless $blocks; # skip symlinks
return if $size < 10;
if ($verbose) {
$len = length $name;
print STDERR $name, ' ', '=' x (77-$len), "\r" if $len < 77;
}
if (open(I, $_)) {
while(<I>) {
printf "%-41s -\t$name\n", $1 while s/"(_\w+)"/"got"/;
}
close I;
} else {
print STDERR "$name: $!\n";
}
}