#!/bin/csh -f
#
# cpconfig - copy a configs directory
#
# This copies a config directory, from which point you can make 
# minor tweaks in the parameters, and rebuild.
# 
# Thus, we don't copy proteus or the results directories.
#
# Part of
#              The STARFISH Parallel file-system simulator
#        (Simulation Tool for Advanced Research in File Systems)
# 
#                               David Kotz
#                           Dartmouth College
#                              Version 3.0
#                              October 1996
#                          dfk@cs.dartmouth.edu

if ($#argv != 2) then
    echo 'usage:  cpconfig fromdir todir'
    exit 1
endif

set from=$1
set to=$2

if (! -d $from) then
    echo $from is not a directory
    exit 1
endif

if (-d $to) then
    echo $to already exists - not overwritten
    exit 1
endif

mkdir $to

foreach i ($from/*)
    if (! -d $i) continue
    set dir=$i:t

    echo $dir
    mkdir $to/$dir

    cp $from/$dir/*.param $to/$dir/
    ln -s ../../base/{Configfile,ParamHelp} $to/$dir
end
