#!/opt/bin/perl
require './pm.pl';

$| = 1;

$Host=shift @ARGV;
$Pass=$Password;

$port=shift @ARGV;

portmaster::Connect("$Host", $Pass);

my($Host_id) = $Host;
$Host_id =~ s/\..*$//; # keep just first part of host name

# get global vals
&portmaster::SysGlobal;

for $num (0..255) {
    $port=sprintf("%c",$num);

    &portmaster::Who("$port");
    
#    printf "%.5s-%3s %10s %15s %13s %15s %4d\n", $Host_id, $PortValue{$port, PORT}, $PortValue{$port, USERNAME}, $PortValue{$port, FRAMED_ADDR}, $PortValue{$port, PORT_TYPE}, $PortValue{$port, STATUS}, $PortValue{$port, IDLETIME};

    if ($PortValue{$port, PORT}) { 
	printf ("$num == $PortValue{$port, PORT}\n");
    }
}


close(portmaster::DS);
