#!/usr/bin/perl

# THE MATERIAL AND/OR SOFTWARE IS PROVIDED 'AS IS'. RATIONAL AND ITS THIRD PARTY LICENSORS DISCLAIM 
# ALL REPRESENTATIONS OR WARRANTIES EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, THE WARRANTY 
# OF MERCHANTABILITY, NON-INFRINGEMENT, TITLE OR FITNESS FOR A PARTICULAR PURPOSE OR ARISING OUT OF THE 
# COURSE OF DEALING, USAGE OR TRADE PRACTICE, CONTENT OF THE MATERIAL OR SOFTWARE. RATIONAL MAKES NO 
# WARRANTIES OR REPRESENTATIONS REGARDING THE ACCURACY OR COMPLETENESS OF THE MATERIAL AND/OR SOFTWARE 
# PROVIDED OR THAT IT WILL MEET LICENSEE'S REQUIREMENTS OR THAT THE MATERIAL AND/OR SOFTWARE WILL BE ERROR 
# FREE. IN NO EVENT SHALL RATIONAL OR ITS LICENSORS BE LIABLE TO LICENSEE OR A THIRD PARTY FOR ANY INDIRECT, 
# DIRECT, NEGLIGENCE, SPECIAL, OR CONSEQUENTIAL DAMAGES INCLUDING LOST PROFITS, LOST DATA AND THE LIKE 
# ARISING OUT OF OR IN CONNECTION WITH THIS RECEIPT OF MATERIAL AND/OR SOFTWARE EVEN IF RATIONAL HAS BEEN 
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


$usage="Usage: $0 <OWNER> <GROUP>\n";
$#ARGV==1 or die $usage;

$ct='/usr/atria/bin/cleartool';

@labels=`$ct lstype -s -kind lbtype`;

for (@labels){
    chomp;
	if(/locked/){
	print "$_ will not be reprotected\n";
    }
    else{
        `$ct protect -chown @ARGV[0] -chgrp @ARGV[1] lbtype:$_`;
	print "reprotected $_\n";
    }
}
