#! /bin/sh

current_dir="`pwd`"

# Test whether -f/--basename option removes all references to the old
# file name.

trap 'rm -fr $tmpfiles' 1 2 3 15

tmpfiles="shar-1.in shar-1.shar"
(umask 22 && echo "This is a test" > shar-1.in)
: ${SHAR=shar}
${SHAR} -f $current_dir/shar-1.in > shar-1.shar 2> /dev/null
result=$?

if test $result -eq 0; then
  tmpfiles="$tmpfiles shar-1.out"
  sed -e 6,10d -e 's/_sh[0-9][0-9][0-9][0-9][0-9][0-9]*/_shPID/' \
      -e 's/-am ..........//' \
      -e 's/(set .. .. .. .. .. .. ../(set .../' shar-1.shar > shar-1.out 2> /dev/null
  : ${DIFF=diff}
  ${DIFF} $top_srcdir/tests/shar-1.ok shar-1.out
  result=$?
fi

rm -fr $tmpfiles

exit $result
