]> i-scream Git - www.i-scream.org.git/commitdiff
This cgi/perl script formats a plain text file in the theme of the website.
authorTim Bishop <tim@bishnet.net>
Wed, 25 Oct 2000 23:56:27 +0000 (23:56 +0000)
committerTim Bishop <tim@bishnet.net>
Wed, 25 Oct 2000 23:56:27 +0000 (23:56 +0000)
It's intended use is for displaying documentation, and other similar files,
formatted according to our documentation specification.

cgi-bin/docs.cgi [new file with mode: 0755]

diff --git a/cgi-bin/docs.cgi b/cgi-bin/docs.cgi
new file mode 100755 (executable)
index 0000000..ea7fdf8
--- /dev/null
@@ -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";
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<!--
+    docs.cgi
+    Web-based text file viewer and formatter.
+    Created by pjm2 19/10/2000
+    Last modified 19/10/2000
+-->
+
+<html>
+
+<head>
+ <title>The i-scream Project Documentation Viewer</title>
+ <meta name="description" content="The i-scream Project is a central monitoring system for Unix, Linux and NT servers.">
+ <meta name="keywords" content="i-scream, project, central monitoring system, unix, linux, nt, server, alert">
+ <meta name="generator" content="notepad on acid, aye.">
+</head>
+
+<body bgcolor="#ffffff" link="#0000ff" alink="#3333cc" vlink="#3333cc" text="#000066">
+
+<table border="0" cellpadding="2" cellspacing="2">
+ <tr>
+  <td valign="top">
+END
+
+&print_file($left);
+
+print <<"END";
+
+  </td>
+  <td valign="top">
+END
+
+&print_file($title);
+
+print "<PRE>\n";
+&print_file($doc);
+print "</PRE>\n";
+
+&print_file($bottom);
+
+print <<"END";
+
+  </td>
+ </tr>
+</table>
+
+</body>
+
+</html>
+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) = <FILE>) {
+        print $line;
+    }
+}
+