#!/bin/sh

PATH=/bin:/usr/bin:/sbin:/usr/sbin
umask 077

tmpdir=/tmp/amavis-test.$$

if [ -d $tmpdir ] ; then
  /bin/rm -rf $tmpdir
fi

if [ -f $tmpdir ] ; then
  /bin/rm -f $tmpdir
fi

if test -z "$USER" ; then
  USER=amavis-tester
fi

if test -z "$HOST" ; then
  HOST=`hostname`
fi

CLIENT="../amavis/amavis"
DAEMON="./amavisd-test"
CONF="./amavisd.conf"

from="$USER@$HOST"
to="$USER@$HOST"
xhdr=`sed -n 's/^$X_HEADER_TAG = "\([^"]*\).*$/\1/p' ${CONF}`:
mta=`sed -n 's/^#.*for amavisd with \([^ ]*\)$/\1/p' ${CONF}`

# for testing, only the number of cmd line args is of importance
case "$mta" in
  exim) args="-f $from -d $to"
        ;;
  libmilter) args="$tmpdir $from $to"
             mkdir $tmpdir
             ;;
  postfix) args="$from $to"
           ;;
  sendmail)
            args="$from $to arg3 arg4"
            ;;
  *) echo "$mta currently not supported by test suite!"
     exit 1
     ;;
esac

