#!/usr/bin/perl -w

use blib;

use strict;
use AFS::VLDB;

my ($vldb, $host, $nores, $prtuid);

die "Usage: $0 [host [noresolv [printuuid]]]\n" if $#ARGV > 2;

$host   = shift;
$nores  = shift;
$prtuid = shift;

$host   = '' unless $host;
$nores  = 0  unless $nores;
$prtuid = 0  unless $prtuid;

$vldb = AFS::VLDB->new;
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);

#host=NULL, uuid=NULL, noresolve=0, printuuid=0
my @list = $vldb->listaddrs($host, '', $nores, $prtuid);
#my @list = $vldb->listaddrs; ???
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);
my $i = 1;
foreach my $srv (@list) {
    print "Server $i:\n";
    $i++;
    foreach (keys %$srv) {
        print "\tKey: $_, Value: $srv->{$_}\n";
    }
}
