if [ x${REMOTE_DIR} = x ]; then
  REMOTE_DIR=/tmp/darcs-ssh-test
fi

if [ x"${USE_PUTTY}" != x ]; then
  DARCS_SSH=plink
  export DARCS_SSH
  DARCS_SCP=pscp
  export DARCS_SCP
  DARCS_SFTP=psftp
  export DARCS_SFTP
fi

if [ x"${USE_CONTROL_MASTER}" != x ]; then
  DARCS_SSH_FLAGS="--ssh-cm"
  export DARCS_SSH_FLAGS
fi

if [ x"${DARCS_SSH}" = x ]; then
  SSH=ssh
else
  SSH=${DARCS_SSH}
fi

rm -rf tempssh
mkdir tempssh
cd tempssh

cleanup () {
  cd ..
  rm -rf tempssh
}

if [ x${REMOTE} = x ]; then
  REMOTE=$(whoami)@localhost
fi

# vim: syntax=sh:

# test if we can connect via ssh, otherwise skip test
${SSH} ${REMOTE} true || exit 200
