diff options
author | Dai Sato <satodai@w3m.jp> | 2006-04-07 15:33:56 +0000 |
---|---|---|
committer | Dai Sato <satodai@w3m.jp> | 2006-04-07 15:33:56 +0000 |
commit | 1014df18200edcd0a0ab72a250c6844fdf3f54b5 (patch) | |
tree | 55c2f271eb1aa4669edbf7d7ab5a0856c3d4b97b /scripts/w3mman/w3mman2html.cgi.in | |
parent | rewind to 10 Feb 2006. (diff) | |
download | w3m-1014df18200edcd0a0ab72a250c6844fdf3f54b5.tar.gz w3m-1014df18200edcd0a0ab72a250c6844fdf3f54b5.zip |
Add w3mman -l <file> command line argument for viewing of local man files.
Diffstat (limited to '')
-rw-r--r-- | scripts/w3mman/w3mman2html.cgi.in | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/scripts/w3mman/w3mman2html.cgi.in b/scripts/w3mman/w3mman2html.cgi.in index f41d487..3cb105d 100644 --- a/scripts/w3mman/w3mman2html.cgi.in +++ b/scripts/w3mman/w3mman2html.cgi.in @@ -19,7 +19,7 @@ if ($QUERY =~ /\=/) { $query{"man"} = &form_decode($QUERY); } -if (! $query{"man"}) { +if ((! $query{"man"}) && (! $query{"local"})) { if ($query{"keyword"}) { $keyword = $query{"keyword"}; $k = &html_quote($keyword); @@ -71,21 +71,29 @@ EOF exit; } -$man = $query{"man"}; -if ($man =~ s/\((\w+)\)$//) { - $section = $1; - $man_section = "$man($1)"; -} elsif ($query{"section"}) { - $section = $query{"section"}; - $man_section = "$man($section)"; +if ($query{"local"}) { + $file = $query{"local"}; + if (! ($file =~ /^\//)) { + $file = $query{"pwd"} . '/' . $file; + } + open(F, "$MAN -l $file 2> /dev/null |"); } else { - $section = ""; - $man_section = "$man"; -} + $man = $query{"man"}; + if ($man =~ s/\((\w+)\)$//) { + $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; undef $header; $blank = -1; @@ -176,6 +184,11 @@ if ($prev) { close(F); if (! $ok) { 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 <<EOF; w3m-control: EXIT @@ -190,7 +203,11 @@ Content-Type: text/html <body> <pre> EOF - print "No manual entry for <B>$man_section</B>.\n"; + if ($query{'local'}) { + print "File <B>$file</B> not found.\n"; + } else { + print "No manual entry for <B>$man_section</B>.\n"; + } } print <<EOF; </pre> |