#!/usr/local/bin/perl
# finger.pl - perl version of finger cgi script
# 	  - written by: Lawrie.brown@adfa.oz.au - Feb 96

print "Content-type: text/html\n\n";	# print mime header

if ($#ARGV < 0) {			# no command-line arguments
	print "<html><head><title>Finger</title></head>\n";
	print "<body><h1>Finger Gateway</h1>\n";
	print "Finger?<isindex></body></html>\n";
} else {				# have query passed
	print "<html><head><title>Finger Response</title></head>\n";
	print "<body><h1>Finger Response</h1>\n";
	$args = "@ARGV";		# collect all args together 
	print "Requested info on: $args\n";
	if ( $args !~ /^[\w\-+ \t\/@%]+$/) {	# check all legal chars
		print "<h2>Illegal Chars</h2>\n";
		print "Your request contains illegal chars!!!\n";
		print "<p>Please go back and re-enter it.\n";
	} else {
		$results = `/usr/ucb/finger @ARGV`;
		print "<pre>\n$results\n</pre>\n";
	}
	print "</body></html>\n";
}	
