File: p4e

package info (click to toggle)
libtk-tablematrix-perl 1.22-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,624 kB
  • ctags: 1,274
  • sloc: ansic: 15,026; perl: 3,376; makefile: 156; sh: 16
file content (48 lines) | stat: -rwxr-xr-x 663 bytes parent folder | download | duplicates (9)
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
#!/usr/local/bin/perl -w
use File::Find;
use Cwd;
my $path = getcwd;

foreach (@ARGV)
 {
  s/\./\\./;
 }          

my $re = '^(?:'.join('|',@ARGV).')$';
$re = qr/$re/;

find(\&wanted,"$path/mTk");

sub wanted
 {
  if ($_ =~ $re)
   {
    my $file = "$File::Find::name";
    unless (-w $file)
     {
      system('p4','edit',$file);
     }                           
    my $cmd = $ENV{'EDITOR'}.' '.$file;
    invoke($cmd);                  
    print "$cmd\n";
   }
 }
    
sub invoke
{
 if ($^O eq 'MSWin32')
  {
   system(1,@_);
  }             
 else
  {
   if ($pid = fork)
    {
     return $pid;
    }            
   else
    {
     exec(@_);
    }
  }
}