From b00a28cbfa82cc8cb295c60d17fdc4dc2fcee0c5 Mon Sep 17 00:00:00 2001 From: "psyc://psyced.org/~lynX" <@> Date: Mon, 28 Dec 2009 04:29:22 +0100 Subject: [PATCH] rkeywordgrep --- utility/rkeywordgrep | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 utility/rkeywordgrep diff --git a/utility/rkeywordgrep b/utility/rkeywordgrep new file mode 100755 index 0000000..e4adb3d --- /dev/null +++ b/utility/rkeywordgrep @@ -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() { + printf "%-41s -\t$name\n", $1 while s/"(_\w+)"/"got"/; + } + close I; + } else { + print STDERR "$name: $!\n"; + } +}