summaryrefslogtreecommitdiffstats
path: root/client.pl
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org> 2013-09-15 16:16:39 +0200
committerGravatar Steven Schubiger <stsc@refcnt.org> 2013-09-15 16:16:39 +0200
commit64059155774e2b35bbff97442e409ec5f0203256 (patch)
treee714d41b8c409cb841bbe6c5f9288829cbc58266 /client.pl
parent577cd6cddb2b1d6bfa21d682308fde6493d9dab6 (diff)
downloaddistdns-64059155774e2b35bbff97442e409ec5f0203256.tar.gz
distdns-64059155774e2b35bbff97442e409ec5f0203256.tar.bz2
List remote entries
Diffstat (limited to 'client.pl')
-rwxr-xr-xclient.pl19
1 files changed, 18 insertions, 1 deletions
diff --git a/client.pl b/client.pl
index 9992c9d..e573f9d 100755
--- a/client.pl
+++ b/client.pl
@@ -45,12 +45,13 @@ Usage: $0
-d, --debug server debugging
-h, --help this help screen
-i, --init initialize session data
+ -l, --list list remote entries
USAGE
exit;
}
my %opts;
-GetOptions(\%opts, qw(d|debug h|help i|init)) or usage();
+GetOptions(\%opts, qw(d|debug h|help i|init l|list)) or usage();
usage() if $opts{h};
my $config = Config::Tiny->new;
@@ -104,6 +105,7 @@ my %params = (
name => $name,
debug => $opts{d} || false,
init => $opts{i} || false,
+ list => $opts{l} || false,
session => $session,
);
@@ -122,6 +124,21 @@ if ($response->is_success) {
$save_session->($session) if $opts{i};
+ if ($opts{l}) {
+ format STDOUT_TOP =
+IP Name PC Netz
+=============================================================================
+.
+ foreach my $entry (sort { $a->{netz} cmp $b->{netz} } @{$data->{entries}}) {
+ format STDOUT =
+@<<<<<<<<<<<<<< @<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<
+@$entry{qw(ip name pc netz)}
+.
+ write;
+ }
+ exit;
+ }
+
my %list;
foreach my $entry (@{$data->{entries}}) {
my $host = "$entry->{ip}\t" . join '.', @$entry{qw(name pc netz)};