#!/bin/sh

# script for creating a copy of the distribution kcl.
# Directories in which no changes are to be made, are linked
# directly. Otherwise a new directory is created linking
# the individual files.  If there are args they are
# the NEWKCL directory, and the KCL_DISTRIB directory

# LK = -s

LN="ln -s"


if [ -d	$1 ]; then NEWKCL=$1;
	else 
	NEWKCL=/usr3/wfs/new/xkcl; 
fi

if [ -d	$2 ]; then KCL_DISTRIB=$2;
	else 
        KCL_DISTRIB=/usr/local/kcl;
fi

echo Using for the new kcl directory :NEWKCL = ${NEWKCL}
echo Assuming the KCL_DISTRIB is KCL_DISTRIB = ${KCL_DISTRIB}

cd $NEWKCL
${LN} $KCL_DISTRIB standard-kcl

KCL=../standard-kcl

CHDIR='o cmpnew lsp unixport c h doc'

cd $NEWKCL
for v in o cmpnew lsp unixport c h doc xbin 
do 
mkdir $v
done

cd $KCL_DISTRIB
for v in *
do 
${LN}  standard-kcl/$v $NEWKCL/$v
done

cd $KCL_DISTRIB
for v in $CHDIR
	 do
	  for w in $v/*
		do
 		echo ${LN}  $KCL/$w $NEWKCL/$w
		${LN}  $KCL/$w $NEWKCL/$w
	done
done






