From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-2.sys.kth.se (smtp-2.sys.kth.se [130.237.32.160]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id pARIucA5016999 for ; Sun, 27 Nov 2011 13:56:38 -0500 (EST) Received: from mailscan-1.sys.kth.se (mailscan-1.sys.kth.se [130.237.32.91]) by smtp-2.sys.kth.se (Postfix) with ESMTP id EDAE914DC5E for ; Sun, 27 Nov 2011 19:56:32 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-2.sys.kth.se ([130.237.32.160]) by mailscan-1.sys.kth.se (mailscan-1.sys.kth.se [130.237.32.91]) (amavisd-new, port 10024) with LMTP id XhRLp6dUVo39 for ; Sun, 27 Nov 2011 19:56:32 +0100 (CET) X-KTH-Auth: kristaps [83.250.6.251] X-KTH-mail-from: kristaps@bsd.lv X-KTH-rcpt-to: tech@mdocml.bsd.lv Received: from macky.local (c83-250-6-251.bredband.comhem.se [83.250.6.251]) by smtp-2.sys.kth.se (Postfix) with ESMTP id CD69714DC4B for ; Sun, 27 Nov 2011 19:56:30 +0100 (CET) Message-ID: <4ED287DE.3030001@bsd.lv> Date: Sun, 27 Nov 2011 19:56:30 +0100 From: Kristaps Dzonsons User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 To: tech@mdocml.bsd.lv Subject: Re: whatis(1) References: <4ED22A28.6040401@bsd.lv> <20111127181301.GA15140@iris.usta.de> In-Reply-To: <20111127181301.GA15140@iris.usta.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 27/11/2011 19:13, Ingo Schwarze wrote: > Hi, > > Kristaps Dzonsons wrote on Sun, Nov 27, 2011 at 01:16:40PM +0100: > >> Enclosed is a simple implementation of whatis(1). It's a mode of >> apropos(1) where arguments are re-written as >> >> foo => Nm~^foo$ >> >> This follows OpenBSD's method; > > Not really. A cursory look gives me the impression that OpenBSD > whatis(1) matches whole words in Nm, case-insentively. However, > i didn't really study the details yet. For example: > > $ whatis man > Pod::Man (3p) - Convert POD data to formatted *roff input > man (1) - display manual pages > man (7) - legacy formatting language for manual pages > man.conf (5) - configuration file for man (1) > >> other systems, like my Mac, search >> for both `Nm' and `Nd', but I'm avoiding this for now because I >> can't figure out the proper regex for word boundaries > > Nm~[[:<:]]man[[:>:]] > >> in multi-word `Nd' strings. > > Nd~[[:<:]]man[[:>:]] # matches Nd only > ~[[:<:]]man[[:>:]] # matches both Nm and Nd > >> Thoughts? > > Something like this will be needed, yes. Ingo, To get the ball rolling, I just checked in whatis.1 and the code modified to use your regexp. I simplified the call into apropos_db.h with termcomp() instead of exprcomp(), as this mode might be useful for man.cgi too. The search expression is now case insensitive and ~[[:<:]]term[[:>:]]. (Thanks!) NOTE: this fixed a subtle bug in apropos_db.h in compiling case insensitive regular expression. Thanks, Kristaps -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv