#!/bin/sh
#
# make the directory of sym links
# echo only if there is a problem
#
#	param 1	= src directory
#	param 2 = dest directory

if  [ "$1x" = "x" ]
then
	echo missing src directory
	exit 0
fi

if  [ "$2x" = "x" ]
then
	echo missing dest directory
	exit 0
fi


CD_DIR_NAME=`basename $1`
LINK_DIR_NAME=$2/$CD_DIR_NAME


if [ ! -d $LINK_DIR_NAME ];
then
	mkdir $LINK_DIR_NAME
fi

if [ ! -d $LINK_DIR_NAME ];
then	
	exit 0
fi

if [ -d $LINK_DIR_NAME ];
then
	cd $LINK_DIR_NAME
	for i in $1/*
	do
#		if there is no sym link, then make one
		if [ ! -h $LINK_DIR_NAME/`basename $i` ]
		then
			ln -s $i .
		fi
	done
fi

