#!/bin/sh
#
# Copyright 1998 - 1999 S. Varshavchik.  See COPYING for
# distribution information.


DIR="$1"
REALDIR="$2"

SOFTLINK=""

echo "mksoftlinks $DIR $REALDIR"

for component in `echo $REALDIR | tr '-' ' '`
do
	if test "$SOFTLINK" = ""
	then
		SOFTLINK="$component"
	else
		SOFTLINK="$SOFTLINK""-$component"
	fi

	if test "$SOFTLINK" != "$REALDIR"
	then
		test -d $DIR/$SOFTLINK/. && continue
		echo rm -f $DIR/$SOFTLINK
		rm -f $DIR/$SOFTLINK
		echo ln -s $REALDIR $DIR/$SOFTLINK
		ln -s $REALDIR $DIR/$SOFTLINK
	fi
done
