tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: tech@mdocml.bsd.lv
Subject: Re: whatis(1)
Date: Sun, 27 Nov 2011 19:56:30 +0100	[thread overview]
Message-ID: <4ED287DE.3030001@bsd.lv> (raw)
In-Reply-To: <20111127181301.GA15140@iris.usta.de>

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

  reply	other threads:[~2011-11-27 18:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-27 12:16 whatis(1) Kristaps Dzonsons
2011-11-27 18:13 ` whatis(1) Ingo Schwarze
2011-11-27 18:56   ` Kristaps Dzonsons [this message]
2011-11-28  0:35     ` whatis(1) Ingo Schwarze
2011-11-28  8:42       ` whatis(1) Kristaps Dzonsons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ED287DE.3030001@bsd.lv \
    --to=kristaps@bsd.lv \
    --cc=tech@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).