#!/usr/local/bin/perl -w

use blib;

use strict;
use AFS::BOS;

my ($server, $cellname, $bos);

die "Usage: $0 server [cell]\n" if $#ARGV < 0;

$server   = shift;
$cellname = shift;

if ($cellname) { $bos = AFS::BOS->new($server, 0, 0, $cellname); }
else           { $bos = AFS::BOS->new($server); }
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);

my ($cell, $hostlist) = $bos->listhosts;
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);

if (defined $cell) { print "Cell name is $cell\n"; }

if (defined $$hostlist[0]) {
    my $i = 1;
    foreach (@$hostlist) {
        print "\tHost $i is $_ \n";
        $i++;
    }
}

$bos->DESTROY;
