# command line parsing, postfix version

# we won't need any of this once amavis
# receives input from SMTP; but then,
# $SENDER and @RECIPS must be initialised
# from the SMTP dialogue

# need two args in any case
if ($#ARGV < 1) {
	do_log(0,"Missing arguments to postfix");
	do_exit($REGERR, __LINE__);
}

if ($enable_relay eq "no") {
	# other LDAs have not been tested yet!
	$LDA = $procmail;
} else {
	$LDA = $sendmail_wrapper;
}

# optionally, we allow to use amvis with a -f <sender> flag
# to make invocation similar to sendmail
if ($ARGV[0] eq "-f") {
	# in this case, we need at least three args
	do_exit($REGERR, __LINE__) if ($#ARGV < 2);

	shift @ARGV;
}

@LDAARGS = @ARGV;
$SENDER = shift @ARGV;
@RECIPS = @ARGV;

if ($LDA eq "$sendmail_wrapper") {
	unshift(@LDAARGS, "-f");
	unshift(@LDAARGS, "-i");
} else {
	@LDAARGS = ();
}

# End postfix cmd line parsing
