#
# Panda
#

if ($panda) {
    do_log(2,"Using $panda");
    $ENV{TERM} = "vt100";
    chop($output = `$panda $TEMPDIR/parts -aut -eng -heu -nso -aex -nor -cmp < /dev/null`);
    $errval = retcode($?);
    $scanner_errors &= $errval;
    # Clean the output file of control chars
    # Clean the escape sequences
    $output =~ s/\e\133(..)G/\n/g;
    $output =~ s/\e(.*?)[A-Z,a-z,>]//g;
    # Clean ^O
    $output =~ s/\017//g;
    # Clean ^H
    $output =~ s/\010(\010+?)\010/\010/g;
    $output =~ s/\010/\n/g;
    # Clean ^M
    $output =~ s/\015//g;
    do_log(2,$output);

    if ($errval) {
	my $loutput = $output;
	my @numVirus = ($loutput =~ /Number of files infected............:(.+)/gm);
	if($numVirus[0] > 0) {
	    @virusname = ($output =~ /Found virus :(.+)/g);
	    do_virus();
	} else {
	    do_log(0,"Virus scanner failure: $panda (error code: $errval)");
	}
    }
}

