[Toybox] [Patch] - adding '-B' to grep
Rob Landley
rob at landley.net
Mon Dec 23 19:07:38 PST 2013
On 12/06/13 11:42, ibid.ag at gmail.com wrote:
> On Fri, Dec 06, 2013 at 06:44:36PM +0530, Ashwini Sharma wrote:
>> Hi Rob, list,
>>
>> _-B_ option support for printing leading context lines, before the match, is
>> added to grep command.
There are actually three related options: -A, -B, and -C. After, Before,
and Context (both). If we're going to do one, might as well do all three.
> I suppose this is something you use, rather than a feature you noticed
> was not present?
Almost certainly.
>> The implementation is based on the queue. Used sys/queue for the purpose.
>
> Please not that way. Would you mind doing it by way of llist/dlist?
I note that patch does something really similar to this. Maintaining
these kind of line buffers is something we've got code and there might
be some opportunities for code sharing. I'll have to look...
I also have the pending todo item of making grep work with embedded NUL
bytes, and I'm implementing -z while I'm there, so my local copy of
grep... doesn't actually compile at the moment, but has a largeish diff
I'm in the process of debugging. :)
Rob
1387854458.0
More information about the Toybox
mailing list