#! /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"
echo "This is a test" > shar-1.in
if [ "x$OSTYPE" = "xmsdosdjgpp" ]; then
  dtou shar-1.in
fi
: ${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]/_shPID/' \
      -e 's/-am ..........//' 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

# Preserve executable bits for this shell script.
# Thanks to Noah Friedman for this great trick.
Local Variables:
eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
eval:(make-local-variable 'file-mode)
eval:(setq file-mode (file-modes (buffer-file-name)))
eval:(make-local-variable 'after-save-hook)
eval:(add-hook 'after-save-hook 'frobme)
End:
