Debian Codegraph @

pTk/p4e

raw
1 #!/usr/local/bin/perl -w
2 use File::Find;
3 use Cwd;
4 my $path = getcwd;
5
6 foreach (@ARGV)
7 {
8 s/\./\\./;
9 s/:\w*$//;
10 }
11
12 my $re = '^(?:'.join('|',@ARGV).')$';
13 $re = qr/$re/;
14
15 find(\&wanted,"$path/mTk");
16
17 sub wanted
18 {
19 if ($_ =~ $re)
20 {
21 my $file = "$File::Find::name";
22 unless (-w $file)
23 {
24 system('p4','edit',$file);
25 }
26 my $cmd = $ENV{'EDITOR'}.' '.$file;
27 invoke($cmd);
28 print "$cmd\n";
29 }
30 }
31
32 sub invoke
33 {
34 if ($^O eq 'MSWin32')
35 {
36 system(1,@_);
37 }
38 else
39 {
40 if ($pid = fork)
41 {
42 return $pid;
43 }
44 else
45 {
46 exec(@_);
47 }
48 }
49 }