Subject: Re: Repalcement for grep(1)
To: Jamie Howard <howardjp@wam.umd.edu>
From: Todd Vierling <tv@pobox.com>
List: tech-userlevel
Date: 07/03/1999 17:00:41
On Sat, 3 Jul 1999, Jamie Howard wrote:

: I also do not use mmap(), I treat the file as a simple stream
: instead.  My code is also a bit slower on larger files, but a bit faster
: on smaller files.  Sometimes I am an order of magnitude slower.  I am
: never that much faster.  I think not using mmap is the reason, but I do
: not know for certain.

After the unified buffer cache modifications happen in the NetBSD kernel,
the difference will be much less noticeable.

: Now, I am having a problem though.  I cannot figure out how to implement
: -w and -x.  For -x, I tried modifying the regular expression (foo) into
: ^(foo)$ before compiling, but that did not work.  I intended to do
: something similar with -w.  Anyway, I am probably missing the obvious, but
: does anyone have any ideas regarding how I should implement -w and -x?

Hm.  Adding ^ and $ should work, provided you don't specify either
REG_NOTBOL or REG_NOTEOL.  (I assume that (foo) above, including the parens,
is the RE.  With the parens, it depends whether you're using standard REs or
extended REs.  :)

Thatnks for this work ... I'll leave it to another soul to do something with
it in NetBSD.

-- 
-- Todd Vierling (tv@pobox.com)