##
print <<"END";
System Administration
END
if ($action eq 'df' ) {
my ($headers_ar, $df_result_ar) = &MySystem::get_df;
# print out the table headers
print "\n";
foreach my $t_head ( @$headers_ar ) {
print "$t_head \n";
}
# end table header
print " \n";
foreach my $hold_ar (@$df_result_ar) {
print "";
foreach (@$hold_ar) {
print "$_ ";
}
print " ";
}
# end table
print "
\n";
}
print <<"END";
END
##
##
sub get_df {
my (@headers,@rows);
# put each line the command returns into an array
my @df = `df -Ph`;
# the first element of the array contains the headers
my $temp_df = shift @df;
@headers = split (/\s+/, $temp_df);
foreach (@df) {
my @parsed_row = split (/\s+/, $_);
unshift @rows, \@parsed_row;
}
return (\@headers, \@rows);
}