#!/usr/bin/perl
# a simple text-based whois client using the Greenwich libs.
# $Id: gwhois,v 1.1 2003/02/11 11:57:15 jodrell Exp $

use lib (-e '@LIBDIR@/Greenwich' ? '@LIBDIR@/Greenwich' : $ENV{PWD}.'/lib');
use Greenwich::WhoisMap;
use Greenwich::WhoisClient;
use strict;

my $query	= $ARGV[0];
my $timeout	= 10;
my $port	= 43;
my $client	= Greenwich::WhoisClient->new();

my ($response, $error) = $client->whois(
	server	=> whois_server($query),
	query	=> $query,
	timeout	=> $timeout,
	port	=> $port
);

if ($error ne '') {
	print STDERR "Error: $error\n";
} else {
	print $response."\n";
}

exit;
