print "Please Enter your work path: ";
$cin_t=<STDIN>;
chomp $cin_t;
&FindAllCVSFileAndChangeRoot($cin_t);
#&ChangeEntries($cin_t);
##########################
sub FindAllCVSFileAndChangeEntries
{
@dir_f = @_;
$path = join(//, @dir_f);
$ret = opendir(CURDIR, $path);
if (!$ret)
{
goto MARK; # It's a file, not a dir.
}
##############################
sub ChangeRoot # replace CVS root
{
my ($fname) = @_;
my @new_file;
Win32::File::GetAttributes($fname, $attrib) || die $!;
Win32::File::SetAttributes($fname, NORMAL) || die $!; #change file attribute to writeble
open(FILE, "<$fname") || die "Can't open the file $fname\n";
while($line = <FILE>)
{
if(($start = index ($line, $str1, 0)) != -1)
{
# $line=~s/$str1/$str2/;
$len = rindex $str1."\$", "\$";
substr($line, $start, $len)=$str2;
print $line;
print "\n";
}
push @new_file, $line;
}
close(FILE);
open(FILE," >$fname") || die "Can't store the file $fname\n";
for $i(0..$#new_file){
print FILE $new_file[$i];
}
close(FILE);
Win32::File::SetAttributes($fname, $attrib) || die $!; #change file attribute back
}
##############################
sub PushDirs # Push a dir name
{
my @dir_fs = @_;
my $path_fs = join(//, @dir_fs);
push (@stack, $path_fs);
}
##############################
sub PopDirs # Pop a dir name。
{
$size = @stack;
if($size != 0)
{
$buf_pop = pop(@stack);
return $buf_pop;
}
print "complete!";
exit();
}