rewind to 10 Feb 2006.

This commit is contained in:
Dai Sato
2006-04-07 15:31:52 +00:00
parent 75a6671d6c
commit 608eca22f6
3 changed files with 17 additions and 46 deletions

View File

@@ -1,4 +1,4 @@
.TH W3MMAN 1 "Nov 5, 2005" .TH W3MMAN 1 "Mar 14, 2002"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@@ -19,9 +19,6 @@ w3mman \- an interface to the on-line reference manuals by w3m(1)
.br .br
.B w3mman .B w3mman
.RI "[-M " path "] -k " keyword .RI "[-M " path "] -k " keyword
.br
.B w3mman
.RI -l " file
.SH DESCRIPTION .SH DESCRIPTION
.B w3mman .B w3mman
is the system's manual pager by is the system's manual pager by
@@ -34,13 +31,9 @@ Specify
.I path .I path
as MANPATH. as MANPATH.
.TP .TP
.BI \-k " keyword" .B \-k " keyword"
Specify Specify
.I keyword. .I keyword.
.TP
.BI \-l " file"
Specify a
.I file.
.SH ENVIRONMENT .SH ENVIRONMENT
.TP .TP
.B W3MMAN_W3M .B W3MMAN_W3M

View File

@@ -8,7 +8,6 @@ sub usage {
($_ = $0) =~ s@.*/@@; ($_ = $0) =~ s@.*/@@;
print STDERR "$_ [-M <path>] [[<section>] <command>]\n"; print STDERR "$_ [-M <path>] [[<section>] <command>]\n";
print STDERR "$_ [-M <path>] [-k <keyword>]\n"; print STDERR "$_ [-M <path>] [-k <keyword>]\n";
print STDERR "$_ [-l <file>]\n";
exit 1; exit 1;
} }
@@ -21,10 +20,6 @@ while (@ARGV) {
} elsif (/^-k$/) { } elsif (/^-k$/) {
@ARGV || &usage(); @ARGV || &usage();
$query = "?keyword=" . &form_encode(shift @ARGV); $query = "?keyword=" . &form_encode(shift @ARGV);
} elsif (/^-l$/) {
@ARGV || &usage();
$query = "?quit=ok&local=" . &form_encode(shift @ARGV);
$query .= "&pwd=" . &form_encode($ENV{'PWD'});
} elsif (/^-/) { } elsif (/^-/) {
&usage(); &usage();
} elsif (/^\d/ || $_ eq 'n') { } elsif (/^\d/ || $_ eq 'n') {

View File

@@ -19,7 +19,7 @@ if ($QUERY =~ /\=/) {
$query{"man"} = &form_decode($QUERY); $query{"man"} = &form_decode($QUERY);
} }
if ((! $query{"man"}) && (! $query{"local"})) { if (! $query{"man"}) {
if ($query{"keyword"}) { if ($query{"keyword"}) {
$keyword = $query{"keyword"}; $keyword = $query{"keyword"};
$k = &html_quote($keyword); $k = &html_quote($keyword);
@@ -71,29 +71,21 @@ EOF
exit; exit;
} }
if ($query{"local"}) { $man = $query{"man"};
$file = $query{"local"}; if ($man =~ s/\((\w+)\)$//) {
if (! ($file =~ /^\//)) { $section = $1;
$file = $query{"pwd"} . '/' . $file; $man_section = "$man($1)";
} } elsif ($query{"section"}) {
open(F, "$MAN -l $file 2> /dev/null |"); $section = $query{"section"};
$man_section = "$man($section)";
} else { } else {
$man = $query{"man"}; $section = "";
if ($man =~ s/\((\w+)\)$//) { $man_section = "$man";
$section = $1;
$man_section = "$man($1)";
} elsif ($query{"section"}) {
$section = $query{"section"};
$man_section = "$man($section)";
} else {
$section = "";
$man_section = "$man";
}
$section =~ s:([^-\w\200-\377.,])::g;
$man =~ s:([^-\w\200-\377.,])::g;
open(F, "$MAN $section $man 2> /dev/null |");
} }
$section =~ s:([^-\w\200-\377.,])::g;
$man =~ s:([^-\w\200-\377.,])::g;
open(F, "$MAN $section $man 2> /dev/null |");
$ok = 0; $ok = 0;
undef $header; undef $header;
$blank = -1; $blank = -1;
@@ -184,11 +176,6 @@ if ($prev) {
close(F); close(F);
if (! $ok) { if (! $ok) {
if ($query{'quit'}) { if ($query{'quit'}) {
if ($query{'local'}) {
print STDERR "File $file not found.\n";
} else {
print STDERR "No manual entry for $man_section.\n";
}
print STDERR "No manual entry for $man_section.\n"; print STDERR "No manual entry for $man_section.\n";
print <<EOF; print <<EOF;
w3m-control: EXIT w3m-control: EXIT
@@ -203,11 +190,7 @@ Content-Type: text/html
<body> <body>
<pre> <pre>
EOF EOF
if ($query{'local'}) { print "No manual entry for <B>$man_section</B>.\n";
print "File <B>$file</B> not found.\n";
} else {
print "No manual entry for <B>$man_section</B>.\n";
}
} }
print <<EOF; print <<EOF;
</pre> </pre>