#!/bin/csh -f
#
# makeParallel <srcDir> <dstDir> [linkDir]
#
#
# Recursively traverse the given directory, and conscuct a parallel one
# making slinks to the RCS directores so later we can do checkouts.
# Also, make links back up to the config files
#
#
set noglob

set srcDir="$1"
set dstDir="$2"

# linkDir defaults to srcDir if they didnt specify, but use the third are to
# keep  track as we recurse...
set linkDir=$srcDir
if ($#argv >= 3) then
	set linkDir="$3"
endif

# make the given directory
mkdir $dstDir

# If there is an rcsdirectory in the linkDir, link to it - SHOULD CHECK BUT ALWAYS
# LINK FOR NOW...
(cd "$dstDir"; ln -s "../$linkDir/RCS" RCS)


# for each subdirectory, recursively call makeParallel
set zzz = `ls $srcDir`		# temp zzz hack workaround HPUX csh bug
if ("$zzz" != "") then
	foreach sd ($zzz)
		if (-d "$srcDir/$sd") then
			if ("$sd" != "RCS") then
				makeParallel "$srcDir/$sd" "$dstDir/$sd" "../$linkDir/$sd"
			endif
		endif
	end;
endif

unset noglob

