From 72f72d64a422d6628c4796f5c0bf2e508f134214 Mon Sep 17 00:00:00 2001
From: Tatsuya Kinoshita <tats@vega.ocn.ne.jp>
Date: Wed, 4 May 2011 16:05:14 +0900
Subject: Adding upstream version 0.5.1

---
 scripts/w3mman/.cvsignore         |   5 +
 scripts/w3mman/Makefile.in        |  96 +++++++++++++
 scripts/w3mman/README             |  54 ++++++++
 scripts/w3mman/hlink.cgi          |  97 ++++++++++++++
 scripts/w3mman/w3mman.1.in        |  53 ++++++++
 scripts/w3mman/w3mman.in          |  41 ++++++
 scripts/w3mman/w3mman2html.cgi.in | 274 ++++++++++++++++++++++++++++++++++++++
 7 files changed, 620 insertions(+)
 create mode 100644 scripts/w3mman/.cvsignore
 create mode 100644 scripts/w3mman/Makefile.in
 create mode 100644 scripts/w3mman/README
 create mode 100644 scripts/w3mman/hlink.cgi
 create mode 100644 scripts/w3mman/w3mman.1.in
 create mode 100644 scripts/w3mman/w3mman.in
 create mode 100644 scripts/w3mman/w3mman2html.cgi.in

(limited to 'scripts/w3mman')

diff --git a/scripts/w3mman/.cvsignore b/scripts/w3mman/.cvsignore
new file mode 100644
index 0000000..e867c6e
--- /dev/null
+++ b/scripts/w3mman/.cvsignore
@@ -0,0 +1,5 @@
+w3mman
+w3mman2html.cgi
+w3mman.1
+
+Makefile
diff --git a/scripts/w3mman/Makefile.in b/scripts/w3mman/Makefile.in
new file mode 100644
index 0000000..ab941c5
--- /dev/null
+++ b/scripts/w3mman/Makefile.in
@@ -0,0 +1,96 @@
+@SET_MAKE@
+SHELL=@SHELL@
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+DOMAIN = $(PACKAGE)
+srcidr=@srcdir@
+top_srcdir=@top_srcdir@
+VPATH= $(srcdir):.
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+datadir = @datadir@
+libdir = @libdir@
+includedir = @includedir@
+infodir = @infodir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+top_srcdir = @top_srcdir@
+VPATH = $(top_srcdir):.
+DESTDIR = 
+
+CGIBIN_DIR = $(libexecdir)/$(PACKAGE)/cgi-bin
+AUXBIN_DIR = $(libexecdir)/$(PACKAGE)
+HELP_DIR = @HELP_DIR@
+RC_DIR = @RC_DIR@
+ETC_DIR = $(sysconfdir)
+CONF_DIR = $(sysconfdir)/$(PACKAGE)
+BIN_DIR = $(bindir)
+MAN1_DIR = $(mandir)/man1
+
+TARGETS		= w3mman
+CGIBIN_TARGETS	= w3mman2html.cgi
+MAN1_TARGETS	= w3mman.1
+MAN_TARGETS	= $(MAN1_TARGETS)
+
+MKDIR		= mkdir -p
+INSTALL		= @INSTALL@
+INSTALL_SCRIPT	= @INSTALL_SCRIPT@
+INSTALL_MAN	= @INSTALL_DATA@
+
+all: $(TARGETS) $(CGIBIN_TARGETS) $(MAN_TARGETS)
+
+# do nothing
+$(TARGETS) $(CGIBIN_TARGETS) $(MAN_TARGETS):
+
+install: $(TARGETS) $(CGIBIN_TARGETS) $(MAN_TARGETS)
+	-$(MKDIR) $(DESTDIR)$(BIN_DIR)
+	-$(MKDIR) $(DESTDIR)$(CGIBIN_DIR)
+	-$(MKDIR) $(DESTDIR)$(MAN1_DIR)
+	for file in $(TARGETS);     \
+	do      \
+		$(INSTALL_SCRIPT) $$file $(DESTDIR)$(BIN_DIR);	\
+	done
+	for file in $(CGIBIN_TARGETS);     \
+	do      \
+		$(INSTALL_SCRIPT) $$file $(DESTDIR)$(CGIBIN_DIR);	\
+	done
+	for file in $(MAN1_TARGETS); \
+	do	\
+		$(INSTALL_MAN) $$file $(DESTDIR)$(MAN1_DIR); \
+	done
+
+uninstall:
+	-for file in $(TARGETS);     \
+	do      \
+		rm -f $(BIN_DIR)/$$file;	\
+	done
+	-for file in $(CGIBIN_TARGETS);     \
+	do      \
+		rm -f $(CGIBIN_DIR)/$$file;	\
+	done
+	-for file in $(MAN1_TARGETS); \
+	do \
+		rm -f $(MAN1_DIR)/$$file; \
+	done
+
+clean:
+
+distclean:
+	-rm -f $(TARGETS) $(CGIBIN_TARGETS) $(MAN_TARGETS)
+	-rm -f Makefile
+
+dist: all
+	@-rm -fr $(distdir)/w3mman
+	-$(MKDIR) $(distdir)/w3mman
+	cp Makefile README w3mman.in w3mman2html.cgi.in hlink.cgi w3mman.1.in $(distdir)/w3mman
+	( cd $(distdir); tar -cf - w3mman | GZIP='' gzip ) \
+		> $(distdir)/w3mman.tar.gz
+	-rm -fr $(distdir)/w3mman
+
diff --git a/scripts/w3mman/README b/scripts/w3mman/README
new file mode 100644
index 0000000..3bcbb3b
--- /dev/null
+++ b/scripts/w3mman/README
@@ -0,0 +1,54 @@
+
+w3mman
+
+    ¾�Υޥ˥奢���إå��ե�����˥�󥯤�Ϥ뤳�Ȥ��Ǥ���
+    man ���ޥ�ɤ����إ��ޥ�ɤǤ���
+
+����ˡ
+
+    w3mman
+    w3mman <command>[(<section>)]
+    w3mman [<section>] <command>
+    w3mman -k <keyword>
+
+�Ķ��ѿ�
+
+    W3MMAN_W3M
+        ���Ѥ��� w3m ���ޥ�ɤ���ꤷ�ޤ�(�ǥե���Ȥ� w3m)
+    W3MMAN_MAN
+        ���Ѥ��� man ���ޥ�ɤ���ꤷ�ޤ�(�ǥե���Ȥ� man)
+
+���󥹥ȡ���
+
+    make install
+    ɬ�פʤ� PERL, MAN, LIBDIR �����ꤷ�Ƥ���������
+    w3mman2html.cgi �⥤�󥹥ȡ��뤵��ޤ���
+
+================
+
+w3mman2html.cgi
+
+����ˡ
+
+    w3m file:///$LIB/w3mman2html.cgi
+    w3m file:///$LIB/w3mman2html.cgi?<command>[(<section>)]
+    w3m file:///$LIB/w3mman2html.cgi?man=<command>[&section=<section>]
+    w3m file:///$LIB/w3mman2html.cgi?keyword=<keyword>
+
+���󥹥ȡ���
+
+    make install
+    ɬ�פʤ� PERL, MAN, LIBDIR �����ꤷ�Ƥ���������
+    w3mman �⥤�󥹥ȡ��뤵��ޤ���
+
+================
+
+hlink.cgi
+
+    �إå��ե�����ʤɤ˥�󥯤�ĥ��
+
+���󥹥ȡ���
+
+    /$LIB/ �˥��ԡ�
+    w3mman2html.cgi �ǻ��Ѥ���ʤ�� $CGI2 �����ꤷ�Ƥ���������
+
diff --git a/scripts/w3mman/hlink.cgi b/scripts/w3mman/hlink.cgi
new file mode 100644
index 0000000..a92ac1d
--- /dev/null
+++ b/scripts/w3mman/hlink.cgi
@@ -0,0 +1,97 @@
+#!/usr/local/bin/perl
+
+$SCRIPT_NAME = $ENV{'SCRIPT_NAME'} || $0;
+$CGI = "file://$SCRIPT_NAME?";
+
+if ($ENV{'QUERY_STRING'}) {
+  $file = $ENV{'QUERY_STRING'};
+} else {
+  $file = $ARGV[0];
+}
+$file = &cleanup($file);
+
+if (-d $file) {
+  print <<EOF;
+Location: file:$file
+EOF
+  exit;
+}
+if (! open(FILE, "< $file")) {
+  $file = &html_quote($file);
+  $_ = "$file: " . &html_quote($!);
+  print <<EOF;
+Content-Type: text/html
+
+<head><title>$file</title></head>
+<b>$_</b>
+EOF
+  exit 1;
+}
+
+$file = &html_quote($file);
+($dir = $file) =~ s@[^/]*$@@;
+
+print <<EOF;
+Content-Type: text/html
+
+<head><title>$file</title></head>
+<pre>
+EOF
+while (<FILE>) {
+  $_ = &html_quote($_);
+
+  s/^(\#\s*include\s+)(\&quot;.*\&quot;|\&lt\;.*\&gt\;)/$1 . &header_ref($2)/ge;
+
+  print;
+}
+close(FILE);
+print "</pre>\n";
+
+sub header_ref {
+  local($_) = @_;
+  local($d);
+
+  if (s/^\&quot;//) {
+    s/\&quot;$//;
+    return "&quot;<a href=\"$CGI$dir$_\">$_</a>&quot;";
+  }
+  s/^\&lt\;//;
+  s/\&gt\;$//;
+
+  for $d (
+	"/usr/include",
+	"/usr/local/include",
+	"/usr/X11R6/include",
+	"/usr/X11/include",
+	"/usr/X/include",
+	"/usr/include/X11"
+  ) {
+    -f "$d/$_" && return "&lt;<a href=\"$CGI$d/$_\">$_</a>&gt;";
+  }
+  return $_;
+}
+
+
+sub html_quote {
+  local($_) = @_;
+  local(%QUOTE) = (
+    '<', '&lt;',
+    '>', '&gt;',
+    '&', '&amp;',
+    '"', '&quot;',
+  );
+  s/[<>&"]/$QUOTE{$&}/g;
+  return $_;
+}
+
+sub cleanup {
+  local($_) = @_;
+
+  s@//+@/@g;
+  s@/\./@/@g;
+  while(m@/\.\./@) {
+    s@^/(\.\./)+@/@;
+    s@/[^/]+/\.\./@/@;
+  }
+  return $_;
+}
diff --git a/scripts/w3mman/w3mman.1.in b/scripts/w3mman/w3mman.1.in
new file mode 100644
index 0000000..eb30237
--- /dev/null
+++ b/scripts/w3mman/w3mman.1.in
@@ -0,0 +1,53 @@
+.TH W3MMAN 1 "Mar 14, 2002"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+w3mman \- an interface to the on-line reference manuals by w3m(1)
+.SH SYNOPSIS
+.B w3mman
+.RI "[-M " path ] " " [ section ] " page"
+.br
+.B w3mman
+.RI "[-M " path "] -k " keyword
+.SH DESCRIPTION
+.B w3mman
+is the system's manual pager by 
+.BR w3m (1).
+.SH OPTIONS
+A summary of options is included below.
+.TP
+.BI \-M " path"
+Specify 
+.I path
+as MANPATH.
+.TP
+.B \-k " keyword"
+Specify 
+.I keyword.
+.SH ENVIRONMENT
+.TP
+.B W3MMAN_W3M
+If W3MMAN_W3M is set, its value is used instead of @W3M@.
+.TP
+.B W3MMAN_MAN
+If W3MMAN_MAN is set, its value is used instead of @MAN@.
+.SH FILES
+.TP
+.I @libexecdir@/@PACKAGE@/cgi-bin/w3mman2html.cgi
+convert manual page to html.
+.SH SEE ALSO
+.BR man (1),
+.BR w3m (1).
+.SH AUTHOR
+This manual page was written by Fumitoshi UKAI <ukai@debian.or.jp>,
+for the Debian GNU/Linux system (but may be used by others).
diff --git a/scripts/w3mman/w3mman.in b/scripts/w3mman/w3mman.in
new file mode 100644
index 0000000..6c6f65d
--- /dev/null
+++ b/scripts/w3mman/w3mman.in
@@ -0,0 +1,41 @@
+#!@PERL@
+
+@W3M = split(' ', $ENV{'W3MMAN_W3M'} || '@W3M@');
+$ENV{'W3MMAN_MAN'} ||= '@MAN@';
+$SCRIPT = 'file:///$LIB/w3mman2html.cgi';
+
+sub usage {
+  ($_ = $0) =~ s@.*/@@;
+  print STDERR "$_ [-M <path>] [[<section>] <command>]\n";
+  print STDERR "$_ [-M <path>] [-k <keyword>]\n";
+  exit 1;
+}
+
+$query = "";
+while (@ARGV) {
+  $_ = shift @ARGV;
+  if (/^-M$/) {
+    @ARGV || &usage();
+    $ENV{'MANPATH'} = shift @ARGV;
+  } elsif (/^-k$/) {
+    @ARGV || &usage();
+    $query = "?keyword=" . &form_encode(shift @ARGV);
+  } elsif (/^-/) {
+    &usage();
+  } elsif (/^\d/ || $_ eq 'n') {
+    @ARGV || &usage();
+    $query = "?quit=ok&man=" . &form_encode(shift @ARGV);
+    $query .= "&section=" . &form_encode($_);
+  } else {
+    $query = "?quit=ok&man=" . &form_encode($_);
+  }
+}
+
+exec @W3M, "$SCRIPT$query";
+
+sub form_encode {
+  local($_) = @_;
+  s/[\000-\040\+:#?&%<>"\177-\377]/sprintf('%%%02X', unpack('C', $&))/eg;
+  return $_;
+}
+
diff --git a/scripts/w3mman/w3mman2html.cgi.in b/scripts/w3mman/w3mman2html.cgi.in
new file mode 100644
index 0000000..f41d487
--- /dev/null
+++ b/scripts/w3mman/w3mman2html.cgi.in
@@ -0,0 +1,274 @@
+#!@PERL@
+
+$MAN = $ENV{'W3MMAN_MAN'} || '@MAN@';
+$QUERY = $ENV{'QUERY_STRING'} || $ARGV[0];
+$SCRIPT_NAME = $ENV{'SCRIPT_NAME'} || $0;
+$CGI = "file://$SCRIPT_NAME";
+$CGI2 = "file:";
+# $CGI2 = "file:///\$LIB/hlink.cgi?";
+$SQUEEZE = 1;
+$ENV{'PAGER'} = 'cat';
+
+if ($QUERY =~ /\=/) {
+  for (split('&', $QUERY)) {
+    ($v, $q) = split('=', $_, 2);
+    $query{$v} = &form_decode($q); 
+  }
+} else {
+  $QUERY =~ s/^man=//;
+  $query{"man"} = &form_decode($QUERY);
+}
+
+if (! $query{"man"}) {
+  if ($query{"keyword"}) {
+    $keyword = $query{"keyword"};
+    $k = &html_quote($keyword);
+    print <<EOF;
+Content-Type: text/html
+
+<html>
+<head><title>man -k $k</title></head>
+<body>
+<h2>man -k <b>$k</b></h2>
+<ul>
+EOF
+    $keyword =~ s:([^-\w\200-\377.,])::g;
+    open(F, "$MAN -k $keyword 2> /dev/null |");
+    @line = ();
+    while(<F>) {
+      chop;
+      $_ = &html_quote($_);
+      s/(\s+-.*)$//;
+      $title = $1;
+      s@(\w[\w.\-]*(\s*\,\s*\w[\w.\-]*)*)\s*(\([\dn]\w*\))@&keyword_ref($1, $3)@ge;
+      print "<li>$_$title\n";
+    }
+    close(F);
+    print <<EOF;
+</ul>
+</body>
+</html>
+EOF
+    exit;
+  }
+  print <<EOF;
+Content-Type: text/html
+
+<html>
+<head><title>man</title></head>
+<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>
+</table>
+</form>
+</body>
+</html>
+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)";
+} 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 |");
+$ok = 0;
+undef $header;
+$blank = -1;
+$cmd = "";
+$prev = "";
+while(<F>) {
+  if (! defined($header)) {
+    /^\s*$/ && next;
+    $header = $_;
+    $space = $header;
+    chop $space;
+    $space =~ s/\S.*//;
+  } elsif ($_ eq $header) {		# delete header
+    $blank = -1;
+    next;
+  } elsif (!/\010/ && /^$space[\w\200-\377].*\s\S/o) {	# delete footer
+    $blank = -1;
+    next;
+  }
+  if ($SQUEEZE) {
+    if (/^\s*$/) {
+      $blank || $blank++;
+      next;
+    } elsif ($blank) {
+      $blank > 0 && print "\n";
+      $blank = 0;
+    }
+  }
+
+  s/\&/\&amp;/g;
+  s/\</\&lt;/g;
+  s/\>/\&gt;/g;
+
+  s@([\200-\377].)(\010{1,2}\1)+@<b>$1</b>@g;
+  s@(\&\w+;|.)(\010\1)+@<b>$1</b>@g;
+  s@__\010{1,2}((\<b\>)?[\200-\377].(\</b\>)?)@<u>$1</u>@g;
+  s@_\010((\<b\>)?(\&\w+\;|.)(\</b\>)?)@<u>$1</u>@g;
+  s@((\<b\>)?[\200-\377].(\</b\>)?)\010{1,2}__@<u>$1</u>@g;
+  s@((\<b\>)?(\&\w+\;|.)(\</b\>)?)\010_@<u>$1</u>@g;
+  s@.\010(.)@$1@g;
+
+  s@\</b\>\</u\>\<b\>_\</b\>\<u\>\<b\>@_@g;
+  s@\</u\>\<b\>_\</b\>\<u\>@_@g;
+  s@\</u\>\<u\>@@g;
+  s@\</b\>\<b\>@@g;
+
+  if (! $ok) {
+    /^No/ && last;
+    print <<EOF;
+Content-Type: text/html
+
+<html>
+<head><title>man $man_section</title></head>
+<body>
+<pre>
+EOF
+    print;
+    $ok = 1;
+    next;
+  }
+
+  s@(http|ftp)://[\w.\-/~]+[\w/]@<a href="$&">$&</a>@g;
+  s@(\W)(mailto:)?(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@$1<a href="mailto:$3">$2$3</a>@g;
+  s@(\W)(\~?/[\w.][\w.\-/~]*)@$1 . &file_ref($2)@ge;
+  s@(include(<\/?[bu]\>|\s)*\&lt;)([\w.\-/]+)@$1 . &include_ref($3)@ge;
+  if ($prev && m@^\s*(\<[bu]\>)*(\w[\w.\-]*)(\</[bu]\>)*(\([\dm]\w*\))@) {
+    $cmd .= "$2$4";
+    $prev =~ s@(\w[\w.\-]*-)((\</[bu]\>)*\s*)$@<a href="$CGI?$cmd">$1</a>$2@;
+    print $prev;
+    $prev = '';
+    s@^(\s*(\<[bu]\>)*)(\w[\w.\-]*)@@;
+    print "$1<a href=\"$CGI?$cmd\">$3</a>";
+  } elsif ($prev) {
+    print $prev;
+    $prev = '';
+  }
+  s@(\w[\w.\-]*)((\</[bu]\>)*)(\([\dm]\w*\))@<a href="$CGI?$1$4">$1</a>$2$4@g;
+  if (m@(\w[\w.\-]*)-(\</[bu]\>)*\s*$@) {
+    $cmd = $1;
+    $prev = $_;
+    next;
+  }
+  print;
+}
+if ($prev) {
+  print $prev;
+}
+close(F);
+if (! $ok) {
+  if ($query{'quit'}) {
+    print STDERR "No manual entry for $man_section.\n";
+    print <<EOF;
+w3m-control: EXIT
+EOF
+    exit 1;
+  }
+  print <<EOF;
+Content-Type: text/html
+
+<html>
+<head><title>man $man_section</title></head>
+<body>
+<pre>
+EOF
+  print "No manual entry for <B>$man_section</B>.\n";
+}
+print <<EOF;
+</pre>
+</body>
+</html>
+EOF
+
+sub is_command {
+  local($_) = @_;
+  local($p);
+
+  (! -d && -x) || return 0;
+  if (! defined(%PATH)) {
+    for $p (split(":", $ENV{'PATH'})) {
+      $p =~ s@/+$@@;
+      $PATH{$p} = 1;
+    }
+  }
+  s@/[^/]*$@@;
+  return defined($PATH{$_});
+}
+
+sub file_ref {
+  local($_) = @_;
+
+  if (&is_command($_)) {
+    ($man = $_) =~ s@.*/@@;
+    return "<a href=\"$CGI?$man\">$_</a>";
+  }
+  if (/^\~/ || -f || -d) {
+    return "<a href=\"$CGI2$_\">$_</a>";
+  }
+  return $_;
+}
+
+sub include_ref {
+  local($_) = @_;
+  local($d);
+
+  for $d (
+	"/usr/include",
+	"/usr/local/include",
+	"/usr/X11R6/include",
+	"/usr/X11/include",
+	"/usr/X/include",
+	"/usr/include/X11"
+  ) {
+    -f "$d/$_" && return "<a href=\"$CGI2$d/$_\">$_</a>";
+  }
+  return $_;
+}
+
+sub keyword_ref {
+  local($_, $s) = @_;
+  local(@a) = ();
+
+  for (split(/\s*,\s*/)) {
+    push(@a, "<a href=\"$CGI?$_$s\">$_</a>");
+  }
+  return join(", ", @a) . $s;
+}
+
+sub html_quote {
+  local($_) = @_;
+  local(%QUOTE) = (
+    '<', '&lt;',
+    '>', '&gt;',
+    '&', '&amp;',
+    '"', '&quot;',
+  );
+  s/[<>&"]/$QUOTE{$&}/g;
+  return $_;
+}
+
+sub form_decode {
+  local($_) = @_;
+  s/\+/ /g;
+  s/%([\da-f][\da-f])/pack('c', hex($1))/egi;
+  return $_;
+}
+
-- 
cgit v1.2.3


From 6db339b3d7a391f196e7c4b725a4ed0bd00f31cf Mon Sep 17 00:00:00 2001
From: Tatsuya Kinoshita <tats@vega.ocn.ne.jp>
Date: Wed, 4 May 2011 16:23:02 +0900
Subject: Adding upstream version 0.5.2

---
 scripts/w3mman/Makefile.in        |  1 +
 scripts/w3mman/w3mman.1.in        | 11 +++++++--
 scripts/w3mman/w3mman.in          |  5 +++++
 scripts/w3mman/w3mman2html.cgi.in | 47 ++++++++++++++++++++++++++-------------
 4 files changed, 47 insertions(+), 17 deletions(-)

(limited to 'scripts/w3mman')

diff --git a/scripts/w3mman/Makefile.in b/scripts/w3mman/Makefile.in
index ab941c5..6c567c7 100644
--- a/scripts/w3mman/Makefile.in
+++ b/scripts/w3mman/Makefile.in
@@ -8,6 +8,7 @@ top_srcdir=@top_srcdir@
 VPATH= $(srcdir):.
 prefix = @prefix@
 exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
 bindir = @bindir@
 datadir = @datadir@
 libdir = @libdir@
diff --git a/scripts/w3mman/w3mman.1.in b/scripts/w3mman/w3mman.1.in
index eb30237..1c0361d 100644
--- a/scripts/w3mman/w3mman.1.in
+++ b/scripts/w3mman/w3mman.1.in
@@ -1,4 +1,4 @@
-.TH W3MMAN 1 "Mar 14, 2002"
+.TH W3MMAN 1 "Nov 5, 2005"
 .\" Please adjust this date whenever revising the manpage.
 .\"
 .\" Some roff macros, for reference:
@@ -19,6 +19,9 @@ w3mman \- an interface to the on-line reference manuals by w3m(1)
 .br
 .B w3mman
 .RI "[-M " path "] -k " keyword
+.br
+.B w3mman
+.RI -l " file
 .SH DESCRIPTION
 .B w3mman
 is the system's manual pager by 
@@ -31,9 +34,13 @@ Specify
 .I path
 as MANPATH.
 .TP
-.B \-k " keyword"
+.BI \-k " keyword"
 Specify 
 .I keyword.
+.TP
+.BI \-l " file"
+Specify a  
+.I file.
 .SH ENVIRONMENT
 .TP
 .B W3MMAN_W3M
diff --git a/scripts/w3mman/w3mman.in b/scripts/w3mman/w3mman.in
index 6c6f65d..6a27e70 100644
--- a/scripts/w3mman/w3mman.in
+++ b/scripts/w3mman/w3mman.in
@@ -8,6 +8,7 @@ sub usage {
   ($_ = $0) =~ s@.*/@@;
   print STDERR "$_ [-M <path>] [[<section>] <command>]\n";
   print STDERR "$_ [-M <path>] [-k <keyword>]\n";
+  print STDERR "$_ [-l <file>]\n";
   exit 1;
 }
 
@@ -20,6 +21,10 @@ while (@ARGV) {
   } elsif (/^-k$/) {
     @ARGV || &usage();
     $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 (/^-/) {
     &usage();
   } elsif (/^\d/ || $_ eq 'n') {
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>
-- 
cgit v1.2.3


From 5397d09e585a1938fb64bc9c5cd5daed1959eb90 Mon Sep 17 00:00:00 2001
From: Tatsuya Kinoshita <tats@vega.ocn.ne.jp>
Date: Wed, 4 May 2011 16:41:45 +0900
Subject: Adding upstream version 0.5.3

---
 scripts/w3mman/CVS/Entries        | 8 ++++++++
 scripts/w3mman/CVS/Repository     | 1 +
 scripts/w3mman/CVS/Root           | 1 +
 scripts/w3mman/Makefile.in        | 1 -
 scripts/w3mman/w3mman2html.cgi.in | 4 ++--
 5 files changed, 12 insertions(+), 3 deletions(-)
 create mode 100644 scripts/w3mman/CVS/Entries
 create mode 100644 scripts/w3mman/CVS/Repository
 create mode 100644 scripts/w3mman/CVS/Root

(limited to 'scripts/w3mman')

diff --git a/scripts/w3mman/CVS/Entries b/scripts/w3mman/CVS/Entries
new file mode 100644
index 0000000..2cc31ff
--- /dev/null
+++ b/scripts/w3mman/CVS/Entries
@@ -0,0 +1,8 @@
+/.cvsignore/1.3/Mon Sep 22 22:53:53 2003//
+/README/1.3/Wed Dec 18 16:48:02 2002//
+/hlink.cgi/1.1/Thu Nov 15 00:32:14 2001//
+/w3mman.1.in/1.6/Fri Apr  7 15:33:56 2006//
+/w3mman.in/1.5/Fri Apr  7 15:33:56 2006//
+/Makefile.in/1.5/Tue Jan  4 09:22:28 2011//
+/w3mman2html.cgi.in/1.9/Tue Jan  4 09:22:28 2011//
+D
diff --git a/scripts/w3mman/CVS/Repository b/scripts/w3mman/CVS/Repository
new file mode 100644
index 0000000..430e75e
--- /dev/null
+++ b/scripts/w3mman/CVS/Repository
@@ -0,0 +1 @@
+w3m/scripts/w3mman
diff --git a/scripts/w3mman/CVS/Root b/scripts/w3mman/CVS/Root
new file mode 100644
index 0000000..121fa06
--- /dev/null
+++ b/scripts/w3mman/CVS/Root
@@ -0,0 +1 @@
+:ext:inu@w3m.cvs.sourceforge.net:/cvsroot/w3m
diff --git a/scripts/w3mman/Makefile.in b/scripts/w3mman/Makefile.in
index 6c567c7..569e2fc 100644
--- a/scripts/w3mman/Makefile.in
+++ b/scripts/w3mman/Makefile.in
@@ -24,7 +24,6 @@ srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 top_srcdir = @top_srcdir@
 VPATH = $(top_srcdir):.
-DESTDIR = 
 
 CGIBIN_DIR = $(libexecdir)/$(PACKAGE)/cgi-bin
 AUXBIN_DIR = $(libexecdir)/$(PACKAGE)
diff --git a/scripts/w3mman/w3mman2html.cgi.in b/scripts/w3mman/w3mman2html.cgi.in
index 3cb105d..f430307 100644
--- a/scripts/w3mman/w3mman2html.cgi.in
+++ b/scripts/w3mman/w3mman2html.cgi.in
@@ -76,7 +76,7 @@ if ($query{"local"}) {
   if (! ($file =~ /^\//)) {
     $file = $query{"pwd"} . '/' . $file;
   }
-  open(F, "$MAN -l $file 2> /dev/null |");
+  open(F, "MAN_KEEP_FORMATTING=1 $MAN -l $file 2> /dev/null |");
 } else {
   $man = $query{"man"};
   if ($man =~ s/\((\w+)\)$//) {
@@ -92,7 +92,7 @@ if ($query{"local"}) {
 
   $section =~ s:([^-\w\200-\377.,])::g;
   $man =~ s:([^-\w\200-\377.,])::g;
-  open(F, "$MAN $section $man 2> /dev/null |");
+  open(F, "MAN_KEEP_FORMATTING=1 $MAN $section $man 2> /dev/null |");
 }
 $ok = 0;
 undef $header;
-- 
cgit v1.2.3


From 620796f8d750bc58e1cf1327ff54aed32e302c73 Mon Sep 17 00:00:00 2001
From: Tatsuya Kinoshita <tats@vega.ocn.ne.jp>
Date: Tue, 22 May 2012 23:06:58 +0900
Subject: Remove garbage files

---
 scripts/w3mman/CVS/Entries    | 8 --------
 scripts/w3mman/CVS/Repository | 1 -
 scripts/w3mman/CVS/Root       | 1 -
 3 files changed, 10 deletions(-)
 delete mode 100644 scripts/w3mman/CVS/Entries
 delete mode 100644 scripts/w3mman/CVS/Repository
 delete mode 100644 scripts/w3mman/CVS/Root

(limited to 'scripts/w3mman')

diff --git a/scripts/w3mman/CVS/Entries b/scripts/w3mman/CVS/Entries
deleted file mode 100644
index 2cc31ff..0000000
--- a/scripts/w3mman/CVS/Entries
+++ /dev/null
@@ -1,8 +0,0 @@
-/.cvsignore/1.3/Mon Sep 22 22:53:53 2003//
-/README/1.3/Wed Dec 18 16:48:02 2002//
-/hlink.cgi/1.1/Thu Nov 15 00:32:14 2001//
-/w3mman.1.in/1.6/Fri Apr  7 15:33:56 2006//
-/w3mman.in/1.5/Fri Apr  7 15:33:56 2006//
-/Makefile.in/1.5/Tue Jan  4 09:22:28 2011//
-/w3mman2html.cgi.in/1.9/Tue Jan  4 09:22:28 2011//
-D
diff --git a/scripts/w3mman/CVS/Repository b/scripts/w3mman/CVS/Repository
deleted file mode 100644
index 430e75e..0000000
--- a/scripts/w3mman/CVS/Repository
+++ /dev/null
@@ -1 +0,0 @@
-w3m/scripts/w3mman
diff --git a/scripts/w3mman/CVS/Root b/scripts/w3mman/CVS/Root
deleted file mode 100644
index 121fa06..0000000
--- a/scripts/w3mman/CVS/Root
+++ /dev/null
@@ -1 +0,0 @@
-:ext:inu@w3m.cvs.sourceforge.net:/cvsroot/w3m
-- 
cgit v1.2.3


From 1d0ba25a660483da1272a31dd077ed94441e3d9f Mon Sep 17 00:00:00 2001
From: Tatsuya Kinoshita <tats@debian.org>
Date: Sat, 2 Jan 2021 09:20:37 +0900
Subject: New upstream version 0.5.3+git20210102

---
 scripts/w3mman/.cvsignore         |  5 ---
 scripts/w3mman/Makefile.in        | 18 ++++++++--
 scripts/w3mman/README             | 34 +++++++++----------
 scripts/w3mman/w3mman.1.in        | 46 +++++++++++++++++--------
 scripts/w3mman/w3mman.de.1.in     | 71 +++++++++++++++++++++++++++++++++++++++
 scripts/w3mman/w3mman.in          | 22 +++++++-----
 scripts/w3mman/w3mman2html.cgi.in | 35 +++++++++++--------
 7 files changed, 170 insertions(+), 61 deletions(-)
 delete mode 100644 scripts/w3mman/.cvsignore
 create mode 100644 scripts/w3mman/w3mman.de.1.in

(limited to 'scripts/w3mman')

diff --git a/scripts/w3mman/.cvsignore b/scripts/w3mman/.cvsignore
deleted file mode 100644
index e867c6e..0000000
--- a/scripts/w3mman/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-w3mman
-w3mman2html.cgi
-w3mman.1
-
-Makefile
diff --git a/scripts/w3mman/Makefile.in b/scripts/w3mman/Makefile.in
index 569e2fc..ad1cffe 100644
--- a/scripts/w3mman/Makefile.in
+++ b/scripts/w3mman/Makefile.in
@@ -33,11 +33,13 @@ ETC_DIR = $(sysconfdir)
 CONF_DIR = $(sysconfdir)/$(PACKAGE)
 BIN_DIR = $(bindir)
 MAN1_DIR = $(mandir)/man1
+MAN1_DE_DIR = $(mandir)/de/man1
 
 TARGETS		= w3mman
 CGIBIN_TARGETS	= w3mman2html.cgi
 MAN1_TARGETS	= w3mman.1
-MAN_TARGETS	= $(MAN1_TARGETS)
+MAN1_DE_TARGETS	= w3mman.de.1
+MAN_TARGETS	= $(MAN1_TARGETS) $(MAN1_DE_TARGETS)
 
 MKDIR		= mkdir -p
 INSTALL		= @INSTALL@
@@ -53,6 +55,7 @@ install: $(TARGETS) $(CGIBIN_TARGETS) $(MAN_TARGETS)
 	-$(MKDIR) $(DESTDIR)$(BIN_DIR)
 	-$(MKDIR) $(DESTDIR)$(CGIBIN_DIR)
 	-$(MKDIR) $(DESTDIR)$(MAN1_DIR)
+	-$(MKDIR) $(DESTDIR)$(MAN1_DE_DIR)
 	for file in $(TARGETS);     \
 	do      \
 		$(INSTALL_SCRIPT) $$file $(DESTDIR)$(BIN_DIR);	\
@@ -65,6 +68,12 @@ install: $(TARGETS) $(CGIBIN_TARGETS) $(MAN_TARGETS)
 	do	\
 		$(INSTALL_MAN) $$file $(DESTDIR)$(MAN1_DIR); \
 	done
+	for file in $(MAN1_DE_TARGETS); \
+	do	\
+		$(INSTALL_MAN) $$file $(DESTDIR)$(MAN1_DE_DIR); \
+		f=`echo "$$file" | sed -e 's/\.de\././'`; \
+		mv $(DESTDIR)$(MAN1_DE_DIR)/$$file $(DESTDIR)$(MAN1_DE_DIR)/$$f; \
+	done
 
 uninstall:
 	-for file in $(TARGETS);     \
@@ -79,6 +88,11 @@ uninstall:
 	do \
 		rm -f $(MAN1_DIR)/$$file; \
 	done
+	-for file in $(MAN1_DE_TARGETS); \
+	do \
+		f=`echo "$$file" | sed -e 's/\.de\././'`; \
+		rm -f $(MAN1_DE_DIR)/$$f; \
+	done
 
 clean:
 
@@ -89,7 +103,7 @@ distclean:
 dist: all
 	@-rm -fr $(distdir)/w3mman
 	-$(MKDIR) $(distdir)/w3mman
-	cp Makefile README w3mman.in w3mman2html.cgi.in hlink.cgi w3mman.1.in $(distdir)/w3mman
+	cp Makefile README w3mman.in w3mman2html.cgi.in hlink.cgi w3mman.1.in w3mman.de.1.in $(distdir)/w3mman
 	( cd $(distdir); tar -cf - w3mman | GZIP='' gzip ) \
 		> $(distdir)/w3mman.tar.gz
 	-rm -fr $(distdir)/w3mman
diff --git a/scripts/w3mman/README b/scripts/w3mman/README
index 3bcbb3b..189e9ac 100644
--- a/scripts/w3mman/README
+++ b/scripts/w3mman/README
@@ -1,54 +1,54 @@
 
 w3mman
 
-    ¾�Υޥ˥奢���إå��ե�����˥�󥯤�Ϥ뤳�Ȥ��Ǥ���
-    man ���ޥ�ɤ����إ��ޥ�ɤǤ���
+    他のマニュアルやヘッダファイルにリンクをはることができる
+    man コマンドの代替コマンドです。
 
-����ˡ
+使用法
 
     w3mman
     w3mman <command>[(<section>)]
     w3mman [<section>] <command>
     w3mman -k <keyword>
 
-�Ķ��ѿ�
+環境変数
 
     W3MMAN_W3M
-        ���Ѥ��� w3m ���ޥ�ɤ���ꤷ�ޤ�(�ǥե���Ȥ� w3m)
+        使用する w3m コマンドを指定します(デフォルトは w3m)
     W3MMAN_MAN
-        ���Ѥ��� man ���ޥ�ɤ���ꤷ�ޤ�(�ǥե���Ȥ� man)
+        使用する man コマンドを指定します(デフォルトは man)
 
-���󥹥ȡ���
+インストール
 
     make install
-    ɬ�פʤ� PERL, MAN, LIBDIR �����ꤷ�Ƥ���������
-    w3mman2html.cgi �⥤�󥹥ȡ��뤵��ޤ���
+    必要なら PERL, MAN, LIBDIR を設定してください。
+    w3mman2html.cgi もインストールされます。
 
 ================
 
 w3mman2html.cgi
 
-����ˡ
+使用法
 
     w3m file:///$LIB/w3mman2html.cgi
     w3m file:///$LIB/w3mman2html.cgi?<command>[(<section>)]
     w3m file:///$LIB/w3mman2html.cgi?man=<command>[&section=<section>]
     w3m file:///$LIB/w3mman2html.cgi?keyword=<keyword>
 
-���󥹥ȡ���
+インストール
 
     make install
-    ɬ�פʤ� PERL, MAN, LIBDIR �����ꤷ�Ƥ���������
-    w3mman �⥤�󥹥ȡ��뤵��ޤ���
+    必要なら PERL, MAN, LIBDIR を設定してください。
+    w3mman もインストールされます。
 
 ================
 
 hlink.cgi
 
-    �إå��ե�����ʤɤ˥�󥯤�ĥ��
+    ヘッダファイルなどにリンクを張る
 
-���󥹥ȡ���
+インストール
 
-    /$LIB/ �˥��ԡ�
-    w3mman2html.cgi �ǻ��Ѥ���ʤ�� $CGI2 �����ꤷ�Ƥ���������
+    /$LIB/ にコピー
+    w3mman2html.cgi で使用するならば $CGI2 に設定してください。
 
diff --git a/scripts/w3mman/w3mman.1.in b/scripts/w3mman/w3mman.1.in
index 1c0361d..68e3afc 100644
--- a/scripts/w3mman/w3mman.1.in
+++ b/scripts/w3mman/w3mman.1.in
@@ -1,4 +1,4 @@
-.TH W3MMAN 1 "Nov 5, 2005"
+.TH W3MMAN 1 "2016-07-13"
 .\" Please adjust this date whenever revising the manpage.
 .\"
 .\" Some roff macros, for reference:
@@ -12,36 +12,54 @@
 .\" .sp <n>    insert n+1 empty lines
 .\" for manpage-specific macros, see man(7)
 .SH NAME
-w3mman \- an interface to the on-line reference manuals by w3m(1)
+w3mman \- an interface to the on-line reference manuals via w3m(1)
 .SH SYNOPSIS
+.\" mh 2016-07-04: "page" is an optional argument.
+.\" Started without it, w3mman displays a form that allows selection
+.\" of a manual page according to section, name and keyword.
+.\" Therefore square brackets introduced
 .B w3mman
-.RI "[-M " path ] " " [ section ] " page"
+[
+.BI \-M " path"
+] [ [
+.I section
+]
+.I page
+]
 .br
 .B w3mman
-.RI "[-M " path "] -k " keyword
+[
+.BI \-M " path"
+] [
+.I section
+]
+.BI \-k " keyword"
 .br
 .B w3mman
-.RI -l " file
+.BI \-l " file"
+.br
 .SH DESCRIPTION
+.\" mh 2016-07-04 text edited. This section shall deliver
+.\" more information than section NAME 
 .B w3mman
-is the system's manual pager by 
-.BR w3m (1).
+is a Perl script that uses 
+.BR w3m (1)
+to serve as a pager for on-line reference manuals.
 .SH OPTIONS
 A summary of options is included below.
 .TP
 .BI \-M " path"
-Specify 
+Specify  
 .I path
-as MANPATH.
+as alternative MANPATH to use.
 .TP
 .BI \-k " keyword"
-Specify 
-.I keyword.
+Specify \fIkeyword\fP.
 .TP
 .BI \-l " file"
-Specify a  
-.I file.
+Specify a \fIfile\fP.
 .SH ENVIRONMENT
+Two variables are available for debugging.
 .TP
 .B W3MMAN_W3M
 If W3MMAN_W3M is set, its value is used instead of @W3M@.
@@ -51,7 +69,7 @@ If W3MMAN_MAN is set, its value is used instead of @MAN@.
 .SH FILES
 .TP
 .I @libexecdir@/@PACKAGE@/cgi-bin/w3mman2html.cgi
-convert manual page to html.
+manual page to HTML converter.
 .SH SEE ALSO
 .BR man (1),
 .BR w3m (1).
diff --git a/scripts/w3mman/w3mman.de.1.in b/scripts/w3mman/w3mman.de.1.in
new file mode 100644
index 0000000..d6c5a44
--- /dev/null
+++ b/scripts/w3mman/w3mman.de.1.in
@@ -0,0 +1,71 @@
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.TH W3MMAN 1 2016\-07\-13  
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+w3mman \- eine Schnittstelle zur Anzeige von Online\-Referenzhandbüchern durch
+w3m(1)
+.SH SYNOPSIS
+.\" mh 2016-07-04: "page" is an optional argument.
+.\" Started without it, w3mman displays a form that allows selection
+.\" of a manual page according to section, name and keyword.
+.\" Therefore square brackets introduced
+\fBw3mman\fP [ \fB\-M\fP \fIPfad\fP ] [ \fIAbschnitt\fP ] [ \fISeite\fP ]
+.br
+\fBw3mman\fP [\fB\-M\fP \fIPfad\fP] \fB\-k\fP \fIStichwort\fP
+.br
+\fBw3mman\fP \fB\-l\fP \fIDatei\fP
+.br
+.SH BESCHREIBUNG
+.\" mh 2016-07-04 text edited. This section shall deliver
+.\" more information than section NAME 
+\fBw3mman\fP ist ein Perl\-Skript, welches auf \fBw3m\fP(1) zurückgreift, um als
+Betrachter für Online\-Referenzhandbücher zu dienen.
+.SH OPTIONEN
+Es folgt eine Zusammenfassung der Optionen.
+.TP 
+\fB\-M\fP\fI Pfad\fP
+Suchpfad für Handbuchseiten auf \fIPfad\fP setzen
+.TP 
+\fB\-k\fP \fIStichwort\fP
+zum \fIStichwort\fP passende Handbuchseiten anzeigen
+.TP 
+\fB\-l\fP \fIDatei\fP
+die Handbuchseiten\-Datei \fIDatei\fP anzeigen
+.SH UMGEBUNGSVARIABLEN
+Zur Fehleranalyse stehen zwei Variablen zur Verfügung.
+.TP 
+\fBW3MMAN_W3M\fP
+Ist W3MMAN_W3M gesetzt, wird ihr Wert anstelle von @W3M@ verwendet.
+.TP 
+\fBW3MMAN_MAN\fP
+Ist W3MMAN_MAN gesetzt, wird ihr Wert anstelle von @MAN@ verwendet.
+.SH DATEIEN
+.TP 
+\fI@libexecdir@/@PACKAGE@/cgi\-bin/w3mman2html.cgi\fP
+Skript, welches Handbuchseiten in HTML konvertiert
+.SH "SIEHE AUCH"
+\fBman\fP(1), \fBw3m\fP(1).
+.SH AUTOR
+Diese Handbuchseite wurde von Fumitoshi UKAI <ukai@debian.or.jp> für
+Debian GNU / Linux geschrieben, sie kann aber auch auf anderen Systemen
+verwendet werden.
+Die deutsche Übersetzung wurde 2016 von
+.UR markus.hiereth@freenet.de
+Markus Hiereth
+.UE
+erstellt.
diff --git a/scripts/w3mman/w3mman.in b/scripts/w3mman/w3mman.in
index 6a27e70..061cb1f 100644
--- a/scripts/w3mman/w3mman.in
+++ b/scripts/w3mman/w3mman.in
@@ -7,7 +7,7 @@ $SCRIPT = 'file:///$LIB/w3mman2html.cgi';
 sub usage {
   ($_ = $0) =~ s@.*/@@;
   print STDERR "$_ [-M <path>] [[<section>] <command>]\n";
-  print STDERR "$_ [-M <path>] [-k <keyword>]\n";
+  print STDERR "$_ [-M <path>] [<section>] [-k <keyword>]\n";
   print STDERR "$_ [-l <file>]\n";
   exit 1;
 }
@@ -20,19 +20,23 @@ while (@ARGV) {
     $ENV{'MANPATH'} = shift @ARGV;
   } elsif (/^-k$/) {
     @ARGV || &usage();
-    $query = "?keyword=" . &form_encode(shift @ARGV);
-  } elsif (/^-l$/) {
-    @ARGV || &usage(); 
-    $query = "?quit=ok&local=" . &form_encode(shift @ARGV);
+    if ( $query eq "" ) { $query = "?quit=ok"; }
+    $query .= "&keyword=" . &form_encode(shift @ARGV);
+  } elsif (/^-l$/ || /\//) {
+    if (/^-l$/) {
+      @ARGV || &usage(); 
+      $_ = shift @ARGV;
+    }
+    $query = "?quit=ok&local=" . &form_encode($_);
     $query .= "&pwd=" . &form_encode($ENV{'PWD'});
   } elsif (/^-/) {
     &usage();
-  } elsif (/^\d/ || $_ eq 'n') {
-    @ARGV || &usage();
-    $query = "?quit=ok&man=" . &form_encode(shift @ARGV);
+  } elsif (/^\d/ || $_ eq 'n' || $_ eq 'l') {
+    if ( $query eq "" ) { $query = "?quit=ok"; }
     $query .= "&section=" . &form_encode($_);
   } else {
-    $query = "?quit=ok&man=" . &form_encode($_);
+    if ( $query eq "" ) { $query = "?quit=ok"; }
+    $query .= "&man=" . &form_encode($_);
   }
 }
 
diff --git a/scripts/w3mman/w3mman2html.cgi.in b/scripts/w3mman/w3mman2html.cgi.in
index f430307..2d326a9 100644
--- a/scripts/w3mman/w3mman2html.cgi.in
+++ b/scripts/w3mman/w3mman2html.cgi.in
@@ -23,18 +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 |");
-    @line = ();
+    open(F, "$MAN $sectionopt -k $keyword 2> /dev/null |");
     while(<F>) {
       chop;
       $_ = &html_quote($_);
@@ -59,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>
@@ -76,7 +81,7 @@ if ($query{"local"}) {
   if (! ($file =~ /^\//)) {
     $file = $query{"pwd"} . '/' . $file;
   }
-  open(F, "MAN_KEEP_FORMATTING=1 $MAN -l $file 2> /dev/null |");
+  open(F, "MAN_KEEP_FORMATTING=1 $MAN $file 2> /dev/null |");
 } else {
   $man = $query{"man"};
   if ($man =~ s/\((\w+)\)$//) {
@@ -126,12 +131,14 @@ while(<F>) {
   s/\&/\&amp;/g;
   s/\</\&lt;/g;
   s/\>/\&gt;/g;
+  # non ASCII UTF-8 codepoint
+  my $utf8="[\300-\337][\200-\277]|[\340-\357][\200-\277]{2}|[\360-\367][\200-\277]{3}|[\370-\373][\200-\277]{4}|[\374\375][\200-\277]{5}";
 
-  s@([\200-\377].)(\010{1,2}\1)+@<b>$1</b>@g;
+  s@($utf8)(\010\1)+@<b>$1</b>@g;
   s@(\&\w+;|.)(\010\1)+@<b>$1</b>@g;
-  s@__\010{1,2}((\<b\>)?[\200-\377].(\</b\>)?)@<u>$1</u>@g;
+  s@_\010((\<b\>)?($utf8)(\</b\>)?)@<u>$1</u>@g;
   s@_\010((\<b\>)?(\&\w+\;|.)(\</b\>)?)@<u>$1</u>@g;
-  s@((\<b\>)?[\200-\377].(\</b\>)?)\010{1,2}__@<u>$1</u>@g;
+  s@((\<b\>)?($utf8)(\</b\>)?)\010_@<u>$1</u>@g;
   s@((\<b\>)?(\&\w+\;|.)(\</b\>)?)\010_@<u>$1</u>@g;
   s@.\010(.)@$1@g;
 
@@ -156,7 +163,7 @@ EOF
   }
 
   s@(http|ftp)://[\w.\-/~]+[\w/]@<a href="$&">$&</a>@g;
-  s@(\W)(mailto:)?(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@$1<a href="mailto:$3">$2$3</a>@g;
+  s@\b(mailto:|)(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@<a href="mailto:$2">$1$2</a>@g;
   s@(\W)(\~?/[\w.][\w.\-/~]*)@$1 . &file_ref($2)@ge;
   s@(include(<\/?[bu]\>|\s)*\&lt;)([\w.\-/]+)@$1 . &include_ref($3)@ge;
   if ($prev && m@^\s*(\<[bu]\>)*(\w[\w.\-]*)(\</[bu]\>)*(\([\dm]\w*\))@) {
@@ -220,7 +227,7 @@ sub is_command {
   local($p);
 
   (! -d && -x) || return 0;
-  if (! defined(%PATH)) {
+  if (! %PATH) {
     for $p (split(":", $ENV{'PATH'})) {
       $p =~ s@/+$@@;
       $PATH{$p} = 1;
-- 
cgit v1.2.3