my $opt_smstest; # 1 or $smscount
my $opt_idle;
my $opt_dry;
+my $opt_single;
sub process;
local $_;
while (<>) {
die "Invalid 'From ' line: $_" if $message eq "" && !/^From /;
- if (/^From / && $message) {
+ if (!$opt_single && /^From / && $message) {
process $message;
$message="";
}
{
my($cmd)=@_;
- $cmd||="spamassassin --exit-code";
+ $cmd||="$HOME/bin/spamassassin --exit-code";
# spamassassin has exit code 1 if IS spam, code 0 if NOT spam
local *CHILD;
local $SIG{"PIPE"}=sub { warn "spamassassin gave me SIGPIPE: broken pipe"; };
die "GetOptions error" if !Getopt::Long::GetOptions(
"inetd" ,sub { $opt_mode=\&inetd; },
"stdin" ,sub { $opt_mode=\&stdin; },
+ "single!" ,\$opt_single,
"dry" ,\$opt_dry,
"smstest:s",sub { $opt_mode=\&stdin; $opt_smstest=($_[1] || 1); },
"idle!" ,\$opt_idle,