Skip to content
Snippets Groups Projects
Commit 72b9d955 authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

rozdeleno tisknuti pouze validnich a vsech klientu

parent a417bee3
No related branches found
No related tags found
No related merge requests found
......@@ -35,13 +35,14 @@ WardenCommon::loadConf($conf_file);
# FUNCTIONS
################################################################################
sub usage {
print "Usage: $RealScript (without parameters) [-h -V]\n";
print "Usage: $RealScript [-a -h -V]\n";
exit 1;
}
sub help {
print "$RealScript (without parameters) [-h -V]\n";
print "$RealScript [-a -h -V]\n";
print "-a print all clients (invalid clients included)\n";
print "-h print this text and exit\n";
print "-V print version and exit\n";
exit 0;
......@@ -57,9 +58,10 @@ sub version {
################################################################################
# MAIN
################################################################################
our ($opt_h, $opt_V);
our ($opt_a, $opt_h, $opt_V);
die usage unless getopts("hV");
die usage unless getopts("ahV");
my $all = $opt_a;
my $help = $opt_h;
my $script_version = $opt_V;
......@@ -77,7 +79,12 @@ if ($script_version) {
my $dbh = WardenCommon::connectDB;
# obtain data from DB
my $sth = $dbh->prepare("SELECT * FROM clients ORDER BY client_id ASC;") or die "Cannot prepare statement: " . $dbh->errstr;
my $sth;
if ($all) {
$sth = $dbh->prepare("SELECT * FROM clients ORDER BY client_id ASC;") or die "Cannot prepare statement: " . $dbh->errstr;
} else {
$sth = $dbh->prepare("SELECT * FROM clients WHERE valid='t' ORDER BY client_id ASC;") or die "Cannot prepare statement: " . $dbh->errstr;
}
$sth->execute or die "Cannot execute statement: " . $sth->errstr;
my $hash_ref = $sth->fetchall_hashref("client_id");
......
......@@ -368,8 +368,9 @@ H. Status Info
2. Get Clients
Function getClients is accessible via getClients.pl. Function has no input
parameters and returns detailed information about all registered clients.
Function getClients is accessible via getClients.pl. Function returns detailed
information about valid or all (-a) registered clients. Parameter -a returns
valid and invalid clients together.
--------------------------------------------------------------------------------
I. Warden Watchdog
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment