#!/usr/bin/perl -w #------------------------------------------------------------ # docs.cgi # # Web-based text file viewer. # Copyright Paul Mutton, 2000. #------------------------------------------------------------ use strict; use CGI; $| = 1; # Settings my ($left) = "../left.inc" ; my ($title) = "../title.inc"; my ($bottom) = "../bottom.inc"; my ($query) = new CGI; my ($doci) = ($query->param('doc') =~ /^\s*(.*?\.txt)\s*$/); my ($doc) = "../documentation/$doci"; print "content-type: text/html\n\n"; print <<"END"; The i-scream Project Documentation Viewer
END &print_file($left); print <<"END"; END &print_file($title); print "
\n";
&print_file($doc);
print "
\n"; &print_file($bottom); print <<"END";
END exit 0; sub print_file ($) { my ($filename) = @_; print `cat $filename`; } sub print_file_old ($) { my ($filename) = @_; open(FILE, $filename) or die "Cannot open $filename: $!\n"; while (my ($line) = ) { print $line; } }