--- a/exiacl Thu Aug 04 09:25:39 2005 +0000
+++ b/exiacl Fri Aug 05 08:35:26 2005 +0000
@@ -25,14 +25,16 @@
src => { ARGS => "=s", DEFAULT => "131.111.8.41" },
dst => { ARGS => "=s" },
- helo => { ARGS => "=s", DEFAULT => "schlittermann.de" },
+ helo => { ARGS => "=s", DEFAULT => "sesame.csx.cam.ac.uk" },
- From => { ARGS => "=s" },
- from => { ARGS => "=s", DEFAULT => "<>" },
+ From => { ARGS => "=s", DEFAULT => "<>" },
+ from => { ARGS => "=s", DEFAULT => "postmaster\@exim.org" },
to => { ARGS => "=s", DEFAULT => "hans\@nowhere.example" },
exim => { ARGS => "=s", DEFAULT => $ENV{EXIM} || "exim" },
+ verbose => { ARGS => "!" },
+
);
@@ -54,12 +56,13 @@
my ($w, $r);
my @cmd = ($Cf->exim,
-C => $Cf->config,
- $Cf->dst ? (-oMi => addr($Cf->dst)) : (),
+ $Cf->dst ? (-oMi => addr($Cf->dst)) : (),
-bhc => addr($Cf->src),
@ARGV); # remaining args are exim native
my $s = new IO::Select;
+warn "@cmd\n";
open3($w, $r, undef, @cmd) or die "Can't run @cmd: $!\n";
read_exim $r;
@@ -73,6 +76,14 @@
read_exim $r;
write_exim $w, "From: ".$Cf->from."\n";
write_exim $w, "To: ".$Cf->to."\n";
+
+if (not -t STDIN) {
+ write_exim $w, "\n";
+ while (<>) {
+ write_exim $w, $_;
+ }
+}
+
write_exim $w, "\n.\n";
read_exim $r;
write_exim $w, "QUIT\n";
@@ -81,10 +92,11 @@
sub read_exim($) {
my $fh = shift;
while (<$fh>) {
- if (/^\d\d\d/) { print "< $_"; }
- else { print STDERR; }
-
- last if /^\d\d\d /;
+ /^\d\d\d/ and print("< $_") and next;
+ /^LOG/ and print STDERR and next;
+ print STDERR if $Cf->verbose;
+ } continue {
+ last if /^\d\d\d\s/;
}
exit if /^5/;
}