#!/usr/bin/perl -w
############################################################
# The code in this file is copyright 2001 by Craig Hughes  #
# It is licensed for use with the SpamAssassin distribution#
# under the terms of the Perl Artistic License, the text of#
# which is included as the file named "License"            #
############################################################

use strict;

use FindBin;
use lib "$FindBin::Bin/../lib";
use Mail::SpamAssassin;
use Mail::SpamAssassin::NoMailAudit;

my $spamtest = Mail::SpamAssassin->new({
    rules_filename => 'rules',
    dont_copy_prefs => 1,
    local_tests_only => 1,
    debug => 0,
    paranoid => 0,
});

for($_=shift @ARGV; defined($_); $_=shift @ARGV)
{
	open (STDIN, "<$_");
	    my @msglines = (<STDIN>);
	    my $mail = Mail::SpamAssassin::NoMailAudit->new (
                                data => \@msglines
                         );

	    my $status = $spamtest->check($mail);
            print $status->get_hits," $_ ",$status->get_names_of_tests_hit,"\n";
	    $status->finish();
}
