On Wed, 14 Mar 2012 20:42:24 +0100 I. Szczesniak wrote:
> On Mon, Mar 5, 2012 at 11:42 PM, Wendy Lin <[email protected]> wrote:
> > I have a long standing feature request: Can the AST grep cmd be moved
> > into libcmd to make it a shell built in, please? Many platforms lack
> > suitable or standard (i.e. POSIX, like SunOS or AIX /bin/grep)
> > conforming grep implementations and a fast, conforming and
> > *accessible* grep implementation within ksh93 would be a *great* plus.
> >
> > Thanks for the consideration.

> +1

> I agree that this would be very useful. The opensolaris illumos ksh93
> already has AST grep as standard builtin, bound to /usr/xpg4/bin/grep,
> but to my surprise the standard ast-open distro does not.

> Glenn, Roland, Olga, can you elaborate?

writing a builtin requires more coding discipline than standalone commands
the upside for this is that ksh93 already uses most of the -last parts that 
grep does
we just have to make sure that grep plays nice with

* memory
* file descriptors
* checking ksh callback for interrupts

the last one is important for possibly long running builtins
they must periodically call a ksh callback function to check for early 
termination
a standalone implementation could just call exit(1) or let the signal default 
terminate
a builtin inner loop is usually in the deepest part of the code
so early termination requires a meticulous unwind to the top

the upside is we think we have all that taken care of
before we add it to -lcmd I think we could use some testing in the wild
I'll see about posting a small package that has the grep family as a ksh 
plugin/builtin
that way we can beta test builtin grep without affecting the main distribution
I think there was also request for builtin xargs, that can go in there too

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to