#!/usr/bin/perl
#
# 2/22/94	Version 1.0, shell script version	Paul Clark
# 4/21/94	Version 1.1, multiple archives support	Paul Clark
# 4/22/94	Version 1.2, perl script		Paul Clark
# 8/05/94	Version 1.3, as aglimpse evolved	Paul Clark
#10/05/94	Version 1.4, with secure aglimpse	Paul Clark

# **** **** **** ****    CONFIGURABLE VARIABLES     **** **** **** ****
$WEBGLIMPSE_HOME = "/usr/src/redhat/BUILD/webglimpse-1.5";

# **** **** **** **** NO CONFIGURATION NEEDED BELOW **** **** **** ****

$indexdir = $ENV{'PATH_INFO'};
$file = $ENV{'QUERY_STRING'};

$indexdir =~ s/\'//g;
$file =~ s/\'//g;

if (!$indexdir) {
	print "Content-type: text/html\n\n";
	print "<TITLE>Directory '$indexdir' not found</TITLE>\n";
	print "<H1>Directory '$indexdir' not found</H1>\n";
	print "Cannot find directory '$indexdir' in the file system\n";
	exit;
}

if (!exec("$WEBGLIMPSE_HOME/getfile '$indexdir' '$file'")) {
	$code = "$!";
	print "Content-type: text/html\n\n";
	print "<TITLE>Cannot execute getfile</TITLE>\n";
	print "<H1>Cannot execute getfile</H1>\n";
	print "Cannot execute $WEBGLIMPSE_HOME/getfile : $code\n";
	exit;
}
# else {
 #    print "Content-type: text/html\n\n";
    # print "<TITLE>Cannot execute getfile</TITLE>\n";
	# print "$indexdir --- $file";
