From b85ad0f3e5db5575c19957c4262383fa96421adc Mon Sep 17 00:00:00 2001 From: Tim Bishop Date: Wed, 25 Oct 2000 23:56:27 +0000 Subject: [PATCH] This cgi/perl script formats a plain text file in the theme of the website. It's intended use is for displaying documentation, and other similar files, formatted according to our documentation specification. --- cgi-bin/docs.cgi | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100755 cgi-bin/docs.cgi diff --git a/cgi-bin/docs.cgi b/cgi-bin/docs.cgi new file mode 100755 index 0000000..ea7fdf8 --- /dev/null +++ b/cgi-bin/docs.cgi @@ -0,0 +1,94 @@ +#!/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; + } +} + -- 2.44.0