From 9ee1dd6e5167d9c2054dee5f9241e3bba286706f Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 13 Mar 2024 15:21:05 +0100 Subject: man: rewrite in Nim Depending on Perl just for this is silly. Now we use libregexp for filtering basically the same things as w3mman2html did. This required another patch to QuickJS to avoid pulling in the entire JS engine, but in return, we can now run regexes without a dummy JS context global variable. Also, man.nim now tries to find a man command on the system even if it's not in /usr/bin/man. --- adapter/protocol/man | 258 --------------------------------------------------- 1 file changed, 258 deletions(-) delete mode 100755 adapter/protocol/man (limited to 'adapter/protocol/man') diff --git a/adapter/protocol/man b/adapter/protocol/man deleted file mode 100755 index c322a6d2..00000000 --- a/adapter/protocol/man +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/env perl -# -# From w3m. -# -# Note that this script has licensing terms different from those of Chawan. -# See /res/license.html#w3m for details. -# -# Usage: install perl, then look up man pages using: -# -# $ cha man:cha # view in any manual (man cha) -# $ cha 'man:cha(1)' # view in a specific manual (man -s 1 cha) -# $ cha man-k:cha # search in any manual (man -k cha) -# $ cha 'man-k:cha(1)' # search in a specific manual (man -k cha -s 1) -# -# You may also use the `mancha` wrapper. - -$MAN = $ENV{'MANCHA_MAN'} || '/usr/bin/man'; -$QUERY = $ENV{'QUERY_STRING'} || $ARGV[0]; -$SCRIPT_NAME = $ENV{'SCRIPT_NAME'} || $0; -$CGI = "man:"; -$CGI2 = "file:"; -# $CGI2 = "file:///\$LIB/hlink.cgi?"; -$SQUEEZE = 1; -$ENV{'PAGER'} = 'cat'; - -if ($QUERY =~ /^man-k:/) { - $QUERY =~ s/^man-k://; - my $keyword = &form_decode($QUERY); - my $sectionopt = ""; - if ($keyword =~ s/(.*)\((\w+)\)$//) { - $keyword = $1; - $sectionopt = "-s $2 "; - } - my $k = &html_quote($keyword); - print < -man $sectionopt-k $k - -

man $sectionopt-k $k

-