use strict;
use lib '/home/httpd/lib/perl/';
use LONCAPA;
use GDBM_File;

while (my $curl = shift) {
    (my $domain,my $cid) = &LONCAPA::split_courseid($curl);
    print("Clone history for $curl".$/);
    while ($cid) {
	print("\t$curl ");

	my $envdb = &propath($domain,$cid).'/environment.db';
	my $dbref=&LONCAPA::locking_hash_tie($envdb,&GDBM_READER());
	$curl = &unescape($dbref->{'clonedfrom'});
	my $desc = &unescape($dbref->{'description'});
	&LONCAPA::locking_hash_untie($dbref);

	print("($desc) <- ".$/);

	($domain,$cid) = &LONCAPA::split_courseid($curl);
    }
    print("no clone info".$/);
}
