#
# AVG Anti-Virus
#

if ($avg and not $avgd) {
    do_log(2,"Using $avg");
    chop($output = `$avg -arc -rt -noparseresult $TEMPDIR/parts`);
    $errval = retcode($?);
    do_log(2,$output);
    if ($errval == 0) { # no errors, no viruses found
	$scanner_errors = 0;
    } elsif ($errval && $errval > 1) { # no errors, viruses discovered
	if ($errval == 5 || $errval == 6) {
	    $scanner_errors = 0;
	    @virusname = ($output =~ /\(@.*\) (.+)/g);
	    do_virus();
	} else {
	    do_log(0,"Virus scanner failure: $avg (error code: $errval)");
	}
    }
}
