From ff7a3e17ec55ca1b9787f0b513b6ae5caa7a3ccc Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 30 Oct 2008 19:08:29 +0000 Subject: [PATCH] add -q quiet option git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2425 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/xdshbak | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/xCAT-client/bin/xdshbak b/xCAT-client/bin/xdshbak index c326476c0..e38442481 100644 --- a/xCAT-client/bin/xdshbak +++ b/xCAT-client/bin/xdshbak @@ -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 () # 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); }