r9239 - /man-cgi/man.cgi
Author: jfs
Date: Tue Jul 3 22:31:00 2012
New Revision: 9239
URL: http://svn.debian.org/wsvn/?sc=1&rev=9239
Log:
Add a subroutine to provide generic information of the information (with
known issues and contact information) as well detailed information of the
service (through a text file).
Move footer generation to a specific subroutine to make it easier to
change in the future.
Also some other minor fixes.
Modified:
man-cgi/man.cgi
Modified: man-cgi/man.cgi
URL: http://svn.debian.org/wsvn/man-cgi/man.cgi?rev=9239&op=diff
==============================================================================
--- man-cgi/man.cgi (original)
+++ man-cgi/man.cgi Tue Jul 3 22:31:00 2012
@@ -118,6 +118,7 @@
);
$manLocalDir = '/srv/manpages.debian.org/extractor/manpages-dists';
+$manFilesDir = '/srv/manpages.debian.org/extractor/manpages-files';
#$manPathDefault = 'Debian Sid';
$manPathDefault = 'Debian 6.0 squeeze';
@@ -278,9 +279,10 @@
# spinner is buggy, shit
local($u) = $www{'home'}.'/cgi-bin/man.cgi';
- local($u)= $BASE;
+ local($u)= $BASE;
return &faq_output($u) if ($path =~ /\/(faq|help)\.html$/);
+ return &info_output($u) if ($path =~ /\/info\.html$/);
#return ©right_output($u) if ($path =~ /copyright.html$/);
return &get_the_sources if ($path =~ /source$/);
@@ -323,8 +325,9 @@
$manpath = $manPathDefault;
}
}
-
-
+ # Debian-specific, provide a package and version
+ $package = $form{'package'};
+ $version = $form{'version'};
# download a man hierarchie as gzip'd tar file
return &download if ($apropos > 1);
@@ -358,6 +361,18 @@
close R;
exit;
}
+
+sub detailed_information {
+ local($file) = '/srv/manpages.debian.org/www/README.txt';
+ $file = $0 if ! -f $file;
+
+ open(R, $file) || &mydie("open $file: $!\n");
+ print "Content-type: text/plain\n\n";
+ while(<R>) { print }
+ close R;
+ exit;
+}
+
# download a manual directory as gzip'd tar archive
sub download {
@@ -438,7 +453,8 @@
open(APROPOS, "$whatpath/whatis.db") || do {
warn "$0: Cannot open whatis database for `mpath'\n";
print "Cannot open whatis database.\n";
- print "</DL>\n</BODY>\n</HTML>\n";
+ print "</DL>\n";
+ print &html_footer();
return;
};
@@ -474,7 +490,8 @@
if (!$acounter) {
print "Sorry, no data found for `$query' ($acounter).\n";
}
- print "</DL>\n</BODY>\n</HTML>\n";
+ print "</DL>\n";
+ print &html_footer();
}
sub man {
@@ -748,8 +765,7 @@
qq{">$sect[$i]</a>} . ($i < $#sect ? " |\n" : "\n");
}
- print "</BODY>\n";
- print "</HTML>\n";
+ print &html_footer();
# Sleep 0.35 seconds to avoid DoS attacs
select undef, undef, undef, 0.35;
@@ -976,7 +992,7 @@
ETX
print "<br>\n";
- print "</BODY>\n</HTML>\n";
+ print &html_footer();
0;
}
@@ -1091,7 +1107,8 @@
</FORM>
<A HREF="$BASE?manpath=$m">home</A> |
-<A HREF="$BASE/help.html">help</A>
+<A HREF="$BASE/help.html">help</A> |
+<A HREF="$BASE/info.html">more information on this service</A>.
<HR>
ETX
0;
@@ -1112,7 +1129,7 @@
Technology, Free Software Foundation, FreeBSD Inc., and others.
</PRE>\n
-This script has the revsion: $id
+This script has the revision: $id
<p>
Copyright (©) for man pages by OS vendors.
@@ -1200,6 +1217,53 @@
};
}
+sub info {
+ return qq{\
+<H1>Information on this service</H1>
+<p>The man-cgi interface used by manpages.debian.net is derived from the
+interface used by <a href="http://www.freebsd.org/cgi/man.cgi">FreeBSD</a> and
+developed by Wolfram Schneider. All the source code for the service, including
+the man-cgi program but also documentation, an installation "step-by-step" as
+well as sample configuration files for common web servers is available at the
+<a href="http://anonscm.debian.org/viewvc/ddp/man-cgi/">SVN repository of the Debian Documentation Project</a>.</p>
+
+<p>This service is used by <a
+href="http://wiki.debian.org/">wiki.debian.org</a>. In the future it might be
+used also from other sites as <a
+href="http://packages.debian.org/">packages.debian.org</a>.</p>
+
+<H1>Service history</H1>
+<p>This service has been running since August 2007. It used to run in an
+official mirror (in Spain) but since the server had <a
+href="http://lists.debian.org/debian-doc/2009/06/msg00022.html">several
+issues</a> in the past failure) it was moved (may 2010) to paganini.debian.org
+and has been running there since.</p>
+
+<p>The number of end-users accesing this interface has not been fully
+investigated. Based on the web stats, the site receives ~5.000 to ~10.000
+unique visitors monthly (average of ~200 daily views).</p>
+
+<H1>Known issues and limitations</H1>
+<p>These are the known issues and limitations of the current service.</p>
+
+<ul>
+<li>The search interface does not make it possible to search by package name.</li>
+<li>The code that extracts the manpages is currently unable to
+maintain manpages of packages that provide the same files (that is, those
+packages that <em>Conflict:</em> because of conflicting binary names). As
+a consequence only one binary manpage can be presented through the interface.
+</li>
+</ul>
+
+<H1>Contact information</H1>
+<p>If you want to contact the maintainer of this service you can use the
+following address: <a href="$webmasterURL">$webmaster</a>. Alternatively,
+you can contact the <a href="http://lists.debian.org/debian-doc/">Debian
+Documentation Mailing List</a>. Patches improving the CGI interface are most
+welcome </p>
+};
+}
+
sub copyright_output {
&http_header("text/html");
print &html_header("HTML hypertext Debian man page interface") .
@@ -1207,29 +1271,38 @@
<HR>
<A HREF="$_[0]">home</A>
-</BODY>
-</HTML>
-};
+ };
+ print &html_footer();
}
sub faq_output {
&http_header("text/html");
- print &html_header("HTML hypertext FreeBSD man page interface") .
+ print &html_header("HTML hypertext Debian man page interface") .
"<H1>$www{'head'}</H1>\n" . &faq . qq{\
<HR>
<A HREF="$_[0]">home</A>
-</BODY>
-</HTML>
-};
-}
+ };
+ print &html_footer();
+}
+
+sub info_output {
+ &http_header("text/html");
+ print &html_header("HTML hypertext Debian man page interface") . &info . qq{\
+<HR>
+
+<A HREF="$_[0]">home</A>
+ };
+ print &html_footer();
+}
+
sub html_header {
my $header="";
$header = qq{<HTML>
<HEAD>
<TITLE>$_[0]</TITLE>
-<link rev="made" href="mailto:jfs\@debian.org">
+<link rev="made" href="$webmasterURL">
<META name="robots" content="nofollow">
<meta content="text/html; charset="};
@@ -1250,6 +1323,16 @@
return $header;
}
+sub html_footer {
+ my $footer ="";
+ $footer = qq{
+<br>
+<A HREF="
+</BODY>
+</HTML>};
+ return $footer;
+}
+
sub secure_env {
$main'ENV{'PATH'} = '/bin:/usr/bin';
$main'ENV{'MANPATH'} = $manPath{$manPathDefault};
@@ -1281,10 +1364,8 @@
print qq{
<p>
<A HREF="$BASE">home</A>
-</BODY>
-</HTML>
};
-
+ print &html_footer();
exit(0);
}
Reply to: