# -*- perl -*-
#
# $Revision: 1.1 $
package fail;

require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(&print_usage &print_version &service_test);
use lib $main::runtimedir;
use csl_utils qw($TIMEOUT %ERRORS);
use strict;

sub print_usage ();
sub print_version ();
sub service_test (%);

sub print_usage () {

    print "
Usage:  Make a service send an error code.
Options:
    --verbose
    --help
    --version
    --usage
";
    return $ERRORS{'OK'};
}

sub print_version () {
    my $version = '$Revision: 1.1 $';
    $version =~ s/^\$Revision: //;
    $version =~ s/ \$\s*$//;

    print "fail.pm - $version\n";
    return $ERRORS{'OK'};
}

sub service_test (%) {
    my %options = @_;

    if ($options{"verbose"}) {
        foreach my $opt (sort keys(%options)) {
            if ($options{$opt}) {
                print "$opt - $options{$opt}\n";
            }
        }
    }

    print "CRITICAL: Test failed.  Passive check didn't send info.\n";
    exit $ERRORS{"CRITICAL"};
}

