aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/w3mman/w3mman2html.cgi.in
diff options
context:
space:
mode:
authorNemo Inis <nemoinis@hotmail.com>2018-12-21 12:16:48 +0000
committerTatsuya Kinoshita <tats@debian.org>2018-12-21 12:16:48 +0000
commit13c0ff556759662b67c20fc12b9d31f041024da2 (patch)
tree64fb4897ca5ed44f06b85f25ff099ffa9f486f5a /scripts/w3mman/w3mman2html.cgi.in
parentUpdate ChangeLog (diff)
downloadw3m-13c0ff556759662b67c20fc12b9d31f041024da2.tar.gz
w3m-13c0ff556759662b67c20fc12b9d31f041024da2.zip
w3mman support for section number during keyword search
Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916968#5
Diffstat (limited to '')
-rw-r--r--scripts/w3mman/w3mman2html.cgi.in20
1 files changed, 13 insertions, 7 deletions
diff --git a/scripts/w3mman/w3mman2html.cgi.in b/scripts/w3mman/w3mman2html.cgi.in
index 2cd00f9..d660681 100644
--- a/scripts/w3mman/w3mman2html.cgi.in
+++ b/scripts/w3mman/w3mman2html.cgi.in
@@ -23,17 +23,23 @@ if ((! $query{"man"}) && (! $query{"local"})) {
if ($query{"keyword"}) {
$keyword = $query{"keyword"};
$k = &html_quote($keyword);
+ if ($query{"section"}) {
+ $section = $query{"section"};
+ $sectionopt = "-s $section ";
+ } else {
+ $sectionopt = "";
+ }
print <<EOF;
Content-Type: text/html
<html>
-<head><title>man -k $k</title></head>
+<head><title>man $sectionopt-k $k</title></head>
<body>
-<h2>man -k <b>$k</b></h2>
+<h2>man $sectionopt-k <b>$k</b></h2>
<ul>
EOF
$keyword =~ s:([^-\w\200-\377.,])::g;
- open(F, "$MAN -k $keyword 2> /dev/null |");
+ open(F, "$MAN $sectionopt -k $keyword 2> /dev/null |");
while(<F>) {
chop;
$_ = &html_quote($_);
@@ -58,10 +64,10 @@ Content-Type: text/html
<body>
<form action="$CGI">
<table>
-<tr><td>Manual:<td><input name=man>
-<tr><td>Section:<td><input name=section>
-<tr><td>Keyword:<td><input name=keyword>
-<tr><td><td><input type=submit> <input type=reset>
+<tr><td>Manual:<td><input name=man />
+<tr><td>Section:<td><input name=section />
+<tr><td>Keyword:<td><input name=keyword />
+<tr><td><td><input type=submit /> <input type=reset />
</table>
</form>
</body>