#!/bin/sh

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

tmpdir=/tmp/amavis-test.$$

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

/bin/rm -f amavis.log debug

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

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

SCRIPT="./amavis-test"

from="$USER@$HOST"
to="$USER@$HOST"
xhdr=`sed -n 's/^my $X_HEADER_TAG = "\([^"]*\).*$/\1/p' ${SCRIPT}`:
mta=`sed -n 's/^.*sending mail, \([^ ]*\) .*$/\1/p' ${SCRIPT}`
lda=`sed -n 's/^my $procmail = "\([^"]*\).*$/\1/p' ${SCRIPT}`

# 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

