#!/usr/bin/perl -w
##########################################################################
# $Id: modprobe,v 1.3 1998/02/23 01:16:57 kirk Exp $
##########################################################################
# $Log: modprobe,v $
# Revision 1.3  1998/02/23 01:16:57  kirk
# Getting ready for a first distribution
#
# Revision 1.2  1998/02/23 00:53:43  kirk
# Finished init and modprobe, and added mountd
#
# Revision 1.1  1998/02/22 03:07:53  kirk
# Re-organization
#
# Revision 1.2  1998/02/12 06:07:17  kirk
# Fixed a few things...
#
# Revision 1.1  1998/02/12 03:54:27  kirk
# Started modprobe filter...
#
##########################################################################

########################################################
# This was written and is maintained by:
#    Kirk Bauer <kirk@kaybee.org>
#
# Please send all comments, suggestions, bug reports,
#    etc, to kirk@kaybee.org.
#
########################################################

$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};

while (defined($ThisLine = <STDIN>)) {
    if ( $ThisLine =~ s/^can\'t locate module (.*)$/$1/ ) {
	chomp($ThisLine);
	$Modules{$ThisLine}++;
    }
    else {
	# Report any unmatched entries...
	push @OtherList,$ThisLine;
    }
}

if ( ($#OtherList >= 0) or (keys(%Modules)) ) {

    if ( ($Detail >= 10) or ($#OtherList >= 0) ) {

	print "\n\n --------------------- ModProbe Begin ------------------------ \n";
    
	if ( $Detail >= 10 ) {
	    print "\nCan't locate these modules:\n";
	    foreach $ThisOne (keys %Modules) {
		print "   " . $ThisOne . ": " . $Modules{$ThisOne} . " Time(s)\n";
	    }
	}
	
	if ($#OtherList >= 0) {
	    print "\n**Unmatched Entries**\n";
	    print @OtherList;
	}
	
	print "\n\n ---------------------- ModProbe End ------------------------- \n\n";

    }
    
}

exit(0);



