From f9c74eac1260cd02302a70adaa4806c297428163 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 27 Jan 2024 12:44:30 +0100 Subject: man: fix man -k --- adapter/protocol/man | 57 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 20 deletions(-) (limited to 'adapter/protocol/man') diff --git a/adapter/protocol/man b/adapter/protocol/man index 7008a95b..88042c9f 100755 --- a/adapter/protocol/man +++ b/adapter/protocol/man @@ -25,33 +25,49 @@ $ENV{'PAGER'} = 'cat'; if ($QUERY =~ /^man-k:/) { $QUERY =~ s/^man-k://; - $query{"keyword"} = &form_decode($QUERY); - if ($query{"keyword"} =~ s/(.*)\((\w+)\)$//) { - $query{"keyword"} = $1; - $query{"section"} = $2; + 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

+