#!/usr/bin/perl
## @file hdStat
# @brief Shows hard disk size
# @details
# @return $OK (0) - if hard disk size was defined successfully
# @return $ERROR (1) - some error happens
# @author Kate Bazhanova
# @date May 2008
# @version 1.00 - Initial version
# @version 1.01 - Two colons were removed before shared functions and variables
# @version 1.02 - Change sequence of baselog and common_functions

=pod

=head1 NAME

B<hdStat> Shows hard disk size

=head1 SYNOPSIS

B<hdStat> [B<--help>]

=head1 DESCRIPTION

B<hdStat> returns full size of the hard disk 

=head1 OPTIONS

=over 4

=item B<-help>

Print this help message and exit.

=back

=head1 EXAMPLES

$ B<hdStat>

Total hard disk size: 76325 MB

If cannot get total hard disk size:

$ B<hdStat>

Cannot get total hard disk size.

=head1 CAVEATS

B<hdStat> shows size only one hard disk root partition refers to.

=head1 SEE ALSO

B<memSizeShow>

=cut

use lib "/opt/nortel/base/lib";

use strict;
use warnings;

use common_variables;
use common_functions;
use baselog;
use hwRecognition;

## @skipline
sub hdStat();

exit(hdStat());

###############################################################################
## @fn hdStat()
# @brief   Main function.
# @details This function shows defined hard disk size if it was defined
#      \li otherwise it shows an error message.
# @return  $OK (0)    -  if hard disk size was defined successfully
# @return  $ERROR (1) -  indicates an error condition.
# @author  Kate Bazhanova
# @date    May 2008

sub hdStat()
{
   my $mbytes = undef;
   my $retval = $OK;

   if (defined $ARGV[0] and $ARGV[0] =~ /help$/)
   {
      print_pod_usage();
      return $retval;
   }

   $mbytes = get_hd_size();
   if ($mbytes)
   {
      print("Total hard disk size: ", $mbytes, " MB\n");
   }
   else
   {
      print("Cannot get total hard disk size.\n");
      $retval = $ERROR;
   }
   return $retval;
} ## end sub hdStat()
