head	1.1;
access;
symbols;
locks
	nocturne:1.1; strict;
comment	@# @;


1.1
date	94.07.15.02.02.28;	author root;	state Exp;
branches;
next	;


desc
@This is the trick that makes old scripts work
@



1.1
log
@Initial revision
@
text
@#!/usr/local/bin/perl

unshift(@@INC, '/var/local/www/local');
%require_map = ('/stats', 'dailyhist.pl',
	'/calendar', 'calendar.pl',
'/reread.conf', 'restart.pl',
'/zlocate', 'zlocate.pl',
'/geo', 'geo.pl',
'/cview', 'cview.pl',
'/weather', 'weather.pl',
'/callsign', 'callsign.pl',
'/pinkdex', 'pinkdex.pl',
'/pinkdex_v', 'pinkdex.pl',
'/testpinkdex', 'testpinkdex.pl',
'/testpinkdex_v', 'testpinkdex.pl',
'/comment', 'comment.pl',
'/dilbert.gif', 'dilbert.httpd.pl',
'/activities', 'afs_safe.pl',
'/coolthing', 'coolthing.pl',
'/coollist', 'coollist.pl',
'/takevote', 'coollist.pl',
'/dovote', 'coollist.pl',
'/stats', 'dailyhist.pl',
'/machine', 'machine.pl',
'/finger', 'finger.pl',
'/forward', 'test.pl',
'/madlib', 'madlibs.pl',
'/cleanup', 'cleanup.pl',
'/zwrite', 'zwrite.pl',
'/home', 'home.pl',
'/muse', 'muse.pl',
'/usmap', 'bogus.pl');

%subroutine_map = ('/stats', 'studliness',
	'/calendar', 'do_calendar',
'/reread.conf', 'do_restart',
'/zlocate', 'do_zlocate',
'/geo', 'do_geo',
'/cview', 'do_cview',
'/weather', 'do_weather',
'/callsign', 'do_callsign',
'/pinkdex', 'do_pinkdex',
'/pinkdex_v', 'do_pinkdex_verbose',
'/testpinkdex', 'do_testpinkdex',
'/testpinkdex_v', 'do_testpinkdex_verbose',
'/comment', 'do_comment',
'/dilbert.gif', 'get_dilbert',
'/coolthing', 'do_coolthing',
'/coollist', 'gen_coollist',
'/takevote', 'take_vote',
'/dovote', 'do_vote',
'/stats', 'studliness',
'/machine', 'do_machine',
'/finger', 'finger_wrapper',
'/forward', 'do_test',
'/madlib', 'do_madlib',
'/cleanup', 'do_cleanup',
'/zwrite', 'zwrite_dispatch',
'/home', 'get_home',
'/muse', 'musit',
'/usmap', 'bogus');

$version = $ENV{'SERVER_PROTOCOL'};
$method = $ENV{'REQUEST_METHOD'};
$path = $ENV{'PATH_INFO'};
$tpath = $ENV{'PATH_TRANSLATED'};
$script = $ENV{'SCRIPT_NAME'};
$query = $ENV{'QUERY_STRING'};
$rhost = $ENV{'REMOTE_HOST'};
$raddr = $ENV{'REMOTE_ADDR'};
$clen = $ENV{'CONTENT_LENGTH'};
$useragent = $ENV{'HTTP_USER_AGENT'};

$query = join(' ', @@ARGV) if $ARGV[0];
print("Content-type: text/html\n");
print("\n");
#print("\nRequest: $method $path ?($query)? $version\n");
#print("Tpath: $tpath, Script $script\n");
#print("From $rhost [$raddr] --> $useragent\n");
#print("Requiring $require_map{$path},",
#	" and trying to run $subroutine_map{$path} ($query)");
require "$require_map{$path}";
#print("Required it\n");
$sub = $subroutine_map{$path};
#print("$subroutine_map{$path} is defined\n") 
#	if defined(&$sub);
&$sub($query);

1;
@
