#!/usr/bin/perl -w
#-----------------------------------------------------------------------------
#
# Copyright (C) 2000 Ryan C. Gordon (icculus@linuxgames.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Revision history:
# 1.0.0 : First release
# 1.0.2 : Minor bugfixes.
# 1.1.0 : Prints version in

, more customizable, optionally allows
# fingering to arbitrary sites for use as a web interface to finger,
# supports VirtualHost sites, better error output.
# 1.1.1 : Highlights URLs and email addresses.
# 1.2.0 : Changed email address. Moved script name to $script_link.
# Reads [title], [url], and [img] tags.
# 1.2.1 : [center] and [font] tags added.
#-----------------------------------------------------------------------------
# TODO: Let [img] tags nest inside [link] tags.
use strict;
# Version of IcculusFinger. Change this if you are forking the code.
my $version = "v1.2.1";
# This is the default title for the webpage. The user can override it with
# the [title] tag in their .plan file.
my $title = "IcculusFinger $version";
# Location where the server can find the finger client it will be using
# to get information. This string is executed and what it writes to stdout
# is read in by this script.
my $fingerprog = "/usr/local/bin/finger";
# Uncomment this to always do finger requests to the same host.
# Define which host the finger request goes to. If you don't define $host,
# then users may finger any system on the internet by specifying a hostname:
# user=dimwit@doofus.com, for example. Not setting $host at all like that
# could leave a mild exploit available.
#my $host = undef; # Makes this script work as a web interface to finger.
#my $host = "icculus.org"; # limit queries to users@icculus.org
my $host = $ENV{SERVER_NAME}; # This is good for VirtualHost setups.
# This is the URL to where the script can be obtained. Feel free to change
# it if you like. Leave it undef'd to not supply a link at all in the
# final HTML output.
#my $scripturl = undef;
#my $scripturl = "/misc/finger.pl";
my $scripturl = "http://icculus.org/IcculusFinger/";
# This is printed after the credits at the bottom change it to whatever you
# like. Obviously, HTML in the string is acceptable, as is an empty string
# (""), but undef doesn't fly here.
my $wittyremark = "Stick it in the camel and go.";
#-----------------------------------------------------------------------------#
# The rest is probably okay without you laying yer dirty mits on it. #
#-----------------------------------------------------------------------------#
my $script_link = (defined $scripturl) ?
"IcculusFinger $version" :
"IcculusFinger $version" ;
sub output_start {
print < $title
__EOF__
}
sub output_ending {
print <