#!/opt/gnu/bin/perl


# this script copies all the items in the user's cdsconfig directory into
# their branch directory  

sub refresh_config {

my($branch_name) = @_;
$home = $ENV{HOME};


# this directory is where the user's goodies exist
# CJS
$cds_config_dir = "$home/cdsconfig";


# go get the listing of files in th the cdsconfig directory. 
opendir (DIR, $cds_config_dir) ||  exit(-1);
local (@filenames) = readdir(DIR);
closedir(DIR);

# symbolic link each of the files in this directory to the branch directory
foreach $f (@filenames) {
	 #printf(STDOUT "$f\n");
	 if(-f "$cds_config_dir/$f") {
          	printf(STDOUT "linking $cds_config_dir/$f to $branch_name/$f - your branch area\n") ;
	  	# unlink the old link
	  	unlink("$branch_name/$f");
	  	system("/bin/ln -s $cds_config_dir/$f $branch_name/$f");
	}# end if
}# end foreach

printf(STDOUT "Finished linking files from $cds_config_dir to your branch area.\n") ;

}# end refresh_config

# this is necessary at the bottom of every subroutine file
1;