Re: [Toybox] [Patch] - adding '-B' to grep

2013-12-23 Thread Rob Landley

On 12/06/13 11:42, ibid...@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
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


[Toybox] [Patch] - adding '-B' to grep

2013-12-06 Thread Ashwini Sharma
Hi Rob, list,

_-B_ option support for printing leading context lines, before the match, is
added to grep command.

The implementation is based on the queue. Used sys/queue for the purpose.

Have a glance at the same.

Regards,
Ashwini


grep.c.patch
Description: Binary data
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [Patch] - adding '-B' to grep

2013-12-06 Thread ibid . ag
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.

I suppose this is something you use, rather than a feature you noticed
was not present?

 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 say this because sys/queue.h is not part of POSIX, but rather a BSD
header (consisting entirely of macros).
And since it's BSD, it has a 3-clause BSD license.
So musl does not include this header due to a policy that all headers
should be public domain, and I imagine that Rob would not like to add a
3-clause header that duplicates the llist/dlist code (in llist.c).

 Have a glance at the same.
 
 Regards,
 Ashwini

Thanks,
Isaac Dunham
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net