#!/bin/sh

test=sf-1

if test "$VERBOSE" = yes; then
  set -x
  ln --version
fi

# Make sure we get English translations.
. $srcdir/../lang-default

tmp=t-ln.$$

test_failure=0
mkdir $tmp || test_failure=1
cd $tmp || test_failure=1
echo foo > a || test_failure=1
ln -s . b || test_failure=1

if test $test_failure = 1; then
  echo 'failure in testing framework'
  exit 1
fi

fail=0
ln -sf a b > err 2>&1 && fail=1
case `cat err` in
  *'are the same file') ;;
  *) fail=1 ;;
esac

cd ..
rm -rf $tmp

exit $fail
