#!/usr/local/bin/jperl
#
# info2www - Gateway between GNU Info nodes and WWW
$id = '$Id: info2www,v 1.2 1994/07/28 15:39:38 lmdrsm Rel lmdrsm $';
#
# This is a script conforming to the CGI - Common Gateway Interface
#
# Author: Roar Smith (lmdrsm@lmd.ericsson.se)
#
# Copyright: This program is in the Public Domain.
#
# The original code (most of &info2html) was written by
# Eelco van Asperen (evas@cs.few.eur.nl).
#
# TODO:
# -----
# * Present a list of choices when there is no exact match for the requested
# Info file but multiple non-exact matches exist.
#
# * Use Tag Table to find possible file and offset.
#
#
#----------------- CONFIGURATION -----------------------------------------------
#
# Set $DEBUG = 1; to debug what's happening
#
$DEBUG = 0;
#
# INFOPATH is the path of direcories in which to search for Info node files.
#
@INFOPATH =
( "/usr/local/info", "/usr/share/info", "/usr/X11R6/info" );
#
# ALLOWPATH specifies whether info files with may be specified with path-names
# outside of those directories included in INFOPATH .
# It is a possible security hole to set this variable to a true value,
# because *any* file on the system could then be accessed through this gateway.
$ALLOWPATH = 0;
#
# ALIAS is a map of aliases - look for the alias if the node itself isn't found.
# The key (first entry) is the node filename, the value (second entry) is the
# alias. Both are basenames (i.e. no path!) with no capital letters.
# Note that the keys *must* be unique!
#
%ALIAS =
(
'emacs', 'lemacs',
'g++', 'gcc',
'c++', 'gcc',
'gunzip', 'gzip',
'zcat' , 'gzip',
'elisp', 'lispref'
);
#
# URL of the icons used for indicating references and stuff:
# $INFO_ICON - Icon at the top left of each document
# $UP_ICON - Icon used in an "Up:" hyperlink at the top
# $NEXT_ICON - Icon used in a "Next:" hyperlink at the top
# $PREV_ICON - Icon used in a "Prev:" hyperlink at the top
# $MENU_ICON - Icon used in front of each menu label
#
# Set these to "" if you don't want them used.
#
$INFO_ICON = "/docs/info2www/infodoc.gif";
$UP_ICON = "/docs/info2www/up.gif";
$NEXT_ICON = "/docs/info2www/next.gif";
$PREV_ICON = "/docs/info2www/prev.gif";
$MENU_ICON = "/docs/info2www/menu.gif";
#
# URL for documentation on info2www
#
# Set this to "" if you don't want it used.
#
$DOCREF = "/docs/info2www/info2www.html";
#
# CACHE is the dbm(3) or ndbm(3) file for cacheing lookup information.
# Set this to "" if you don't want it used.
# The effective user of this script should have write permissions to
# the directory in which the dbm files reside.
#
$CACHE = "/var/adm/info2www_cache";
#
# These are the defines for file-locking with flock(2)
#
$LOCK_SH = 1;
$LOCK_EX = 2;
$LOCK_NB = 4;
$LOCK_UN = 8;
# Backgroud color
$BGCOLOR='BGCOLOR="#fff8dc"';
#----------------- MAIN --------------------------------------------------------
print "Content-type: text/html\n"; #-- Mime header for NCSA httpd
print "\n";
print "$id
\n" if $DEBUG;
$pg = $0; $pg =~ s,^.*/([^/]*)$,$1,;
($version, $date) = ($id =~ m@,v\s+([0-9.]+)\s+([0-9/]+)@);
$script_name = $ENV{'SCRIPT_NAME'};
$server_name = $ENV{'SERVER_NAME'};
$request_method = $ENV{'REQUEST_METHOD'};
$prefix = $script_name . "?"; # prefix for HREF= entries
if ($request_method ne 'GET') {
die "REQUEST_MODE 'GET' expected - got '$request_method'\n";
}
print "ARGV: ", join('+', @ARGV), "
\n" if $DEBUG;
if ($#ARGV == -1) {
$nodename = "(DIR)";
} else {
$nodename = join('+', @ARGV);
$nodename = &DeEscape($nodename);
}
print "nodename: ", $nodename, "
\n" if $DEBUG;
&info2html($nodename);
if ($DOCREF) {
print
"