1 |
tdb |
1.1 |
#!/usr/bin/perl -w |
2 |
|
|
|
3 |
|
|
#------------------------------------------------------------ |
4 |
|
|
# docs.cgi |
5 |
|
|
# |
6 |
|
|
# Web-based text file viewer. |
7 |
|
|
# Copyright Paul Mutton, 2000. |
8 |
|
|
#------------------------------------------------------------ |
9 |
|
|
|
10 |
|
|
use strict; |
11 |
|
|
use CGI; |
12 |
|
|
|
13 |
|
|
$| = 1; |
14 |
|
|
|
15 |
|
|
# Settings |
16 |
|
|
my ($left) = "../left.inc" ; |
17 |
|
|
my ($title) = "../title.inc"; |
18 |
|
|
my ($bottom) = "../bottom.inc"; |
19 |
|
|
|
20 |
|
|
|
21 |
|
|
my ($query) = new CGI; |
22 |
|
|
my ($doci) = ($query->param('doc') =~ /^\s*(.*?\.txt)\s*$/); |
23 |
|
|
my ($doc) = "../documentation/$doci"; |
24 |
|
|
|
25 |
|
|
print "content-type: text/html\n\n"; |
26 |
|
|
|
27 |
|
|
print <<"END"; |
28 |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
29 |
|
|
|
30 |
|
|
<!-- |
31 |
|
|
docs.cgi |
32 |
|
|
Web-based text file viewer and formatter. |
33 |
|
|
Created by pjm2 19/10/2000 |
34 |
|
|
Last modified 19/10/2000 |
35 |
|
|
--> |
36 |
|
|
|
37 |
|
|
<html> |
38 |
|
|
|
39 |
|
|
<head> |
40 |
|
|
<title>The i-scream Project Documentation Viewer</title> |
41 |
|
|
<meta name="description" content="The i-scream Project is a central monitoring system for Unix, Linux and NT servers."> |
42 |
|
|
<meta name="keywords" content="i-scream, project, central monitoring system, unix, linux, nt, server, alert"> |
43 |
|
|
<meta name="generator" content="notepad on acid, aye."> |
44 |
|
|
</head> |
45 |
|
|
|
46 |
|
|
<body bgcolor="#ffffff" link="#0000ff" alink="#3333cc" vlink="#3333cc" text="#000066"> |
47 |
|
|
|
48 |
|
|
<table border="0" cellpadding="2" cellspacing="2"> |
49 |
|
|
<tr> |
50 |
|
|
<td valign="top"> |
51 |
|
|
END |
52 |
|
|
|
53 |
|
|
&print_file($left); |
54 |
|
|
|
55 |
|
|
print <<"END"; |
56 |
|
|
|
57 |
|
|
</td> |
58 |
|
|
<td valign="top"> |
59 |
|
|
END |
60 |
|
|
|
61 |
|
|
&print_file($title); |
62 |
|
|
|
63 |
|
|
print "<PRE>\n"; |
64 |
|
|
&print_file($doc); |
65 |
|
|
print "</PRE>\n"; |
66 |
|
|
|
67 |
|
|
&print_file($bottom); |
68 |
|
|
|
69 |
|
|
print <<"END"; |
70 |
|
|
|
71 |
|
|
</td> |
72 |
|
|
</tr> |
73 |
|
|
</table> |
74 |
|
|
|
75 |
|
|
</body> |
76 |
|
|
|
77 |
|
|
</html> |
78 |
|
|
END |
79 |
|
|
|
80 |
|
|
exit 0; |
81 |
|
|
|
82 |
|
|
sub print_file ($) { |
83 |
|
|
my ($filename) = @_; |
84 |
|
|
print `cat $filename`; |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
sub print_file_old ($) { |
88 |
|
|
my ($filename) = @_; |
89 |
|
|
open(FILE, $filename) or die "Cannot open $filename: $!\n"; |
90 |
|
|
while (my ($line) = <FILE>) { |
91 |
|
|
print $line; |
92 |
|
|
} |
93 |
|
|
} |
94 |
|
|
|