$S = "\001";
#$S = ";";
sub traverse
{
local($dir, $lev, $onfile, $ondir, $onsymlink) = @_;
local($dirent);
local($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks);
local($dirhandle) = "dh$lev";
opendir($dirhandle, $dir);
while (($dirent = readdir($dirhandle)))
{
if ($dirent eq "." || $dirent eq "..") { next; }
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = lstat("$dir/$dirent");
typsw:
{
-f _ && do
{
if (defined(&$onfile)) { &$onfile("$dir", "$dirent"); }
last typsw;
} ;
-d _ && do
{
if (defined(&$ondir)) { &$ondir("$dir", "$dirent"); }
do traverse("$dir/$dirent", $lev+1, $onfile, $ondir, $onsymlink);
last typsw;
} ;
-l "$dir/$dirent" && do
{
if (defined(&$onsymlink)) { &$onsymlink("$dir", "$dirent"); }
if ($SYM_SPECIAL && $lev == 0)
{ do traverse("$dir/$dirent", $lev+1, $onfile, $ondir, $onsymlink); }
last typsw;
} ;
}
}
closedir($dirhandle);
}
sub rm
{
my($path) = @_;
my($sts) = 0;
if (-e $path)
{
verbose "$Myname> unlink $path";
$sts = unlink $path;
$sts = (! $sts);
if ($sts) { verbose "$Myname: *** \"unlink $path\" returned $sts"; }
}
return $sts;
}
sub co
{
my ($cmd, $do, $file) = @_;
if (&s($cmd, $do))
{
open(TMP, ">$file") or die "couldn't create $file: $!";
print TMP "failed on:\n$cmd\n\n",
"If you need it talk to your local conversion guru\n"
or die "couldn't print $file: $!";
close(TMP) or die "couldn't close $file: $!";
}
0;
}
sub rlog
{
co(@_);
}
sub s
{
my ($cmd, $doit) = @_;
my ($sts);
if (! defined($doit)) { $doit = 1; }
if (! $doit)
{
verbose "$Myname; $cmd";
return;
}
verbose "$Myname> $cmd";
if (($sts = system($cmd)) != 0)
{
my $sig = $sts & 0x0f;
$sts = $sts >> 8;
verbose "$Myname: *** \"$cmd\" exited with signal $sig status $sts";
return $sts;
}
return 0;
}
1;
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #2 | 863 | Matthew Rice | Matt's cvs2p4 1.2.16 release | ||
| #1 | 862 | Matthew Rice | Branched off of Richard's 1.2.15 release. | ||
| //guest/richard_geiger/utils/cvs2p4/lib/util.pl | |||||
| #2 | 249 | Richard Geiger |
Changes in preparation for supporting spaces in filenames. (In fact, this may work as of this change, but is not yet tested.) Also, add "runtest -gengood" to allow easier generatino of new *.good files. (It just doesn't quick on a miscompare!). |
||
| #1 | 130 | Richard Geiger |
CVS-to-Perforce converter. This is release 1.2.2 (first submit to the Perforce Public Depot) |
||