#!/usr/bin/perl

########################################################################
#
# pminfo Ver 2.1 Beta 1
#
# Patches      : Gary E. Miller <gem@rellim.com>
# Interpreter  : Perl v5.002
# Portmaster   : ComOS 3.3.1
# Description  : a hack to suck the global variables from Livingston 
#                products.
#
# Usage        : pminfo host [passwd]
#######################################################################
# Version 1.0
# Author       : Brian Pollack
#######################################################################

require 'pm.pl';

$Host = $ARGV[0];
$Pass = $ARGV[1] || $Password;

if ( portmaster::Connect("$Host", $Pass) ) {
	die "Cannot open: $Host\n";
}

$Nameservice{715} = "DNS";
$Nameservice{203} = "NIS";

@Vals = &portmaster::SysGlobal;

# for debuging
#print "@Vals, \n\n";

# Print the unknown values in hopes that someone recognizes them and
# send e-mail to gem@rellim.com
#foreach ( sort(keys %GlobalValue)) {
#  $K = $_;
#  print "the value of $_ is $GlobalValue{$K}\n";
#}

# Print a pretty list

print "
Livingston Portmaster v$GlobalValue{VERSION} - $GlobalValue{NUMPORTS} Port;
Status           : $GlobalValue{STATUS}
Internet Address : $GlobalValue{IPADDRESS}/ $GlobalValue{NETMASK}
Assigned Address : $GlobalValue{ASSIGNED}
IPX Address      : $GlobalValue{IPXADDRESS}
Telnet Port      : $GlobalValue{TELNET}
IP Gateway       : $GlobalValue{IPGATEWAY}
Default Host	 : $GlobalValue{DEFHOST}
Secondary Host   : $GlobalValue{ALTHOST}
Domain Name      : $GlobalValue{DOMAIN}
Nameservice      : $GlobalValue{NAMESVC}
Nameserver 1     : $GlobalValue{NAMESERVER1}
Nameserver 2     : $GlobalValue{NAMESERVER2}
Authenticator    : $GlobalValue{RADIUS}
Secondary Rad    : $GlobalValue{ALTRADIUS}
";

close(portmaster::DS);
