change exit code to unknown on help and version info

Signed-off-by: Sven Nierlein <sven@nierlein.de>
This commit is contained in:
Sven Nierlein 2015-10-04 18:48:23 +02:00
parent 741710c27c
commit d6baf9dbce
14 changed files with 30 additions and 30 deletions

View file

@ -28,10 +28,10 @@ GetOptions
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
($opt_H) || usage("Host name/address not specified\n");
my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);

View file

@ -54,10 +54,10 @@ GetOptions
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@'); #'
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
my $smbclient = $utils::PATH_TO_SMBCLIENT;
$smbclient || usage("check requires smbclient, smbclient not set\n");

View file

@ -60,12 +60,12 @@ GetOptions(
if ($opt_V) {
print_revision($PROGNAME, '@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
$opt_f = shift unless ($opt_f);

View file

@ -58,7 +58,7 @@ GetOptions
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
unless (defined $opt_t) {
@ -66,7 +66,7 @@ unless (defined $opt_t) {
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
unless (defined $opt_F) {
print "Missing license.dat file\n";

View file

@ -367,17 +367,17 @@ sub process_arguments() {
if ($status == 0){
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if (! utils::is_hostname($hostname)){

View file

@ -119,7 +119,7 @@ $status = process_arguments();
if ($status != 0)
{
print_help() ;
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
@ -313,17 +313,17 @@ sub process_arguments() {
if ($status == 0){
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
unless (defined $timeout) {

View file

@ -181,10 +181,10 @@ MAIN:
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
($opt_H) || ($opt_H = shift @ARGV) || usage("Host name/address not specified\n");
my $remotehost = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);

View file

@ -573,12 +573,12 @@ sub process_arguments(){
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if (defined $opt_v ){

View file

@ -130,7 +130,7 @@ sub process_arguments {
if (defined $opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
syntax("Help:") if ($help);

View file

@ -45,10 +45,10 @@ GetOptions("V" => $opt_V, "version" => $opt_V,
"H=s" => $opt_H, "hostname=s" => $opt_H);
# -h means display verbose help screen
if($opt_h){ print_help(); exit 0; }
if($opt_h){ print_help(); exit 3; }
# -V means display version number
if ($opt_V) { print_version(); exit 0; }
if ($opt_V) { print_version(); exit 3; }
# -H means host name
$opt_H = shift unless ($opt_H);
@ -70,7 +70,7 @@ if ($opt_s) {
$server = $1;
} else {
print "$opt_s is not a valid host name";
exit -1;
exit 3;
}
}

View file

@ -98,12 +98,12 @@ GetOptions
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
# jitter test params specified

View file

@ -63,12 +63,12 @@ GetOptions(
);
# -h means display verbose help screen
if ($opt_h) { print_help(); exit $ERRORS{'OK'}; }
if ($opt_h) { print_help(); exit $ERRORS{'UNKNOWN'}; }
# -V means display version number
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
# Hash containing all RPC program names and numbers

View file

@ -31,12 +31,12 @@ GetOptions
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@'); #'
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
$opt_H = shift unless ($opt_H);

View file

@ -15,7 +15,7 @@ my $successOutput = '/^check_rpc/';
my $t;
$t += checkCmd( "./check_rpc -V", 0, $successOutput );
$t += checkCmd( "./check_rpc -V", 3, $successOutput );
exit(0) if defined($Test::Harness::VERSION);
exit($tests - $t);