add -q quiet option

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2425 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2008-10-30 19:08:29 +00:00
parent f4cbeb4712
commit ff7a3e17ec

View File

@ -25,6 +25,7 @@ use Getopt::Std;
# -h : usage #
# -x : omit extra header output for each node. #
# Can not be used with -c. #
# -q : quiet mode #
# #
# Ouputs: #
# Filtered output #
@ -49,7 +50,7 @@ $::dsh_command = 'xdshbak';
#
# Process the command line...
#
if (!getopts('cxh'))
if (!getopts('cxhq'))
{ # Gather options; if errors
&d_syntax;
exit(-1);
@ -72,6 +73,11 @@ if ($::opt_c)
$compress++;
}
if ($::opt_q)
{
$quiet++;
}
#
# Read stdin until eof. If compaction is not specified, create an array
# of the following data structures, one element per host:
@ -103,7 +109,10 @@ while (<STDIN>)
# feedback on lines processed
#
$num_lines++;
if (!($quiet)) {
if ($::opt_x) { $num_lines % 100 == 0 && print STDOUT "."; }
else { $num_lines % 1000 == 0 && print STDOUT "."; }
}
if (/: /)
{
@fields = split(': ', $_);
@ -190,13 +199,14 @@ else
sub d_syntax
{
my $usage1 = "Usage: xdshbak [-c | -x | -h] \n";
my $usage1 = "Usage: xdshbak [-c | -x | -h | -q] \n";
my $usage2 =
"-c : compresses the output by listing unique output only once.\n";
my $usage3 = "-h : help \n";
my $usage4 =
"-x : omit extra header output for each node. Can not be used with -c. \n";
my $usage = $usage1 .= $usage2 .= $usage3 .= $usage4;
my $usage5 = "-q : quiet mode.\n";
my $usage = $usage1 .= $usage2 .= $usage3 .= $usage4 .= $usage5;
xCAT::MsgUtils->message("I", $usage);
}