#!/usr/bin/perl
use warnings;
use strict;
####
7 use subs qw(
8 error_exit
9 usage
10 precheck
11 generic_check
12 perl_module_check
13 print_ok
14 print_notok
15 print_info
16 print_verbose
17 );
####
sub error_exit;
sub usage;
sub precheck;
sub generic_check;
sub perl_module_check;
sub print_ok;
sub print_notok;
sub print_info;
sub print_verbose;
####
21 @Default_Tools_List = (
22 [ 'gzip' ,'app', '' , 'generic_check' ],
23 [ 'gunzip' ,'app', '' , 'generic_check' ],
24 [ 'tar', ,'app', '' , 'generic_check' ],
25 [ 'tr', ,'app', '' , 'generic_check' ],
26 [ 'date' ,'app', '' , 'generic_check' ],
27 [ 'ps', ,'app', '' , 'generic_check' ],
28 [ 'cat', ,'app', '' , 'generic_check' ],
29 [ 'id', ,'app', '' , 'generic_check' ],
30 [ 'echo' ,'app', '' , 'generic_check' ],
31 [ 'pwd', ,'app', '' , 'generic_check' ],
32 [ 'chmod' ,'app', '' , 'generic_check' ],
33 [ 'ln', ,'app', '' , 'generic_check' ],
34 [ 'cp', ,'app', '' , 'generic_check' ],
35 [ 'rpm', ,'app', '' , 'generic_check' ],
36 [ 'clear' ,'app', '' , 'generic_check' ],
37 [ 'dirname' ,'app', '' , 'generic_check' ],
38 [ 'df' ,'app', '' , 'generic_check' ],
39 [ 'Carp' ,'perlm', 'Perl Module - Carp', 'perl_module_check' ],
40 ) ;
41
42
43 $Tools_Hash = \@Default_Tools_List ;
####
my $Tools_Hash = [
[ 'gzip' ,'app', '' , \&generic_check ],
[ 'gunzip' ,'app', '' , \&generic_check ],
[ 'tar' ,'app', '' , \&generic_check ],
[ 'tr' ,'app', '' , \&generic_check ],
[ 'date' ,'app', '' , \&generic_check ],
[ 'ps' ,'app', '' , \&generic_check ],
[ 'cat' ,'app', '' , \&generic_check ],
[ 'id' ,'app', '' , \&generic_check ],
[ 'echo' ,'app', '' , \&generic_check ],
[ 'pwd' ,'app', '' , \&generic_check ],
[ 'chmod' ,'app', '' , \&generic_check ],
[ 'ln' ,'app', '' , \&generic_check ],
[ 'cp' ,'app', '' , \&generic_check ],
[ 'rpm' ,'app', '' , \&generic_check ],
[ 'clear' ,'app', '' , \&generic_check ],
[ 'dirname' ,'app', '' , \&generic_check ],
[ 'df' ,'app', '' , \&generic_check ],
[ 'Carp' ,'perlm', 'Perl Module - Carp', \&perl_module_check ],
];
####
59 %precheck_stuff = ($KSH, $PERL);
220 for $ent (@precheck_stuff) {
221 if( ! -f $ent ) {
222 print_info "$ent not found\n" ;
223 $ret = 1 if($ret == 0);
224 }
225 }
####
93 my @more_paths = split(/\s+/, $more_paths);
113 my @extra_tools_tochk = split(/\s+/, $extra_tools);
128 push (@extra_tools_tochk, split(/\s+/, $l));
138 my @exclude_checks = split(/\s+/, $exclude_list);
146 my @implicit_checks = split(/\s+/, $implicit_list);
####
92 chomp($more_paths);
112 chomp($extra_tools);
121 chomp($tools_from_file);
137 chomp($exclude_list);
145 chomp($implicit_list);
####
115 push(@{$Tools_Hash}, [ $elem, 'app', $elem, 'generic_check']);
131 push(@{$Tools_Hash}, [ $elem, 'app', $elem, 'generic_check']);
154 push(@{$Tools_Hash}, [ $elem, 'app', $elem, 'generic_check']);
####
175 foreach $component ( @{$Tools_Hash} ) {
176 my $entity = $component->[0] ; # first thing is the entity to check.
177 if($things_to_check{$entity} == 1 ) {
178 $check_function = $component->[-1] ; # last thing is the function to check.
179 $ret = \&$check_function($entity, splice(@{$component},1,-1)); #rest of the inbetween things are args to function.
180 }
181 }
####
for my $component ( @$Tools_Hash ) {
my $entity = shift @$component; # first thing is the entity to check.
if ( $things_to_check{ $entity } == 1 ) {
my $check_function = pop @$component; # last thing is the function to check.
my $ret = $check_function->( $entity, @$component ); #rest of the inbetween things are args to function.
}
}
####
240 print_info sprintf "%-${cf_flen}s", $show_user ;
282 print_info sprintf "%-${cf_flen}s", $show_user ;
####
print_info sprintf '%-*s', $cf_flen, $show_user ;