#!/afs/athena/contrib/perl/p

while($ARGV[0]=~/-/){
	if($ARGV[0] eq '-o'){
		shift(@ARGV);
		$owner_mode++;
		$ownc=shift(@ARGV);
		$ownc =~ s/\D//;
	}
}

while(<>){
	$fc = substr($_,0,1);
	if($fc ne '!'){
		if($fc eq '#'){
			$obj[$onum]=$object;
			&create_obj($onum, $object);
			$n = $_;
			$_ =~ s/\D//;
			$onum = int($_);
			$object = '';
			$_ = $n;
		}
		$object .= $_;
	}
}
$obj[$onum]=$object;
&create_obj($onum, $object);
$_ =~ s/\D//;
$onum = int($_);
$object = '';

sub create_obj {
	local($num, $descrip) = @_;

	@f = split(/\n/, $descrip);
	$name[$num]=$f[2];
	$owner[$num]=$f[7];
	if($owner_mode){
		if($owner[$num] eq $ownc){
			print($descrip);
		}
	}
}
