#! /bin/sh

test "X${VERBOSE}" = Xtrue && {
  set -x
  PS4="> "
}

tmppfx=shar-2-$$

mkdir ${tmppfx}.dir ${tmppfx}.d ${tmppfx}.d/one ${tmppfx}.d/two
for d in "" /one /two
do
  dir=${tmppfx}.d${d}
  echo This file is ${dir}/first > ${dir}/first
  {
    printf "This file is ${dir}/second\n"
    f=0
    while test $f -lt 32
    do  printf "\\$f"
        f=`expr $f + 1`
    done
    printf "\nThis file is ${dir}/second\n"
  } > ${dir}/second 2>/dev/null
done

: ${SHAR=`cd ../src ; pwd`/shar}
: ${UNSHAR=`cd ../src ; pwd`/unshar}
( cd ${tmppfx}.d
  ${SHAR} -m . 2>/dev/null
) > ${tmppfx}.shar

: ${DIFF=diff}

cd ${tmppfx}.dir
${UNSHAR} ../${tmppfx}.shar || exit 1
cd -

${DIFF} -r ${tmppfx}.d ${tmppfx}.dir || exit 1

rm -rf ${tmppfx}.*
exit 0

## Local Variables:
## mode: shell-script
## tab-width: 8
## indent-tabs-mode: nil
## sh-indentation: 2
## sh-basic-offset: 2
## End:

## end of shar-2
