[BusyBox] regex updates

Mark Whitley markw at lineo.com
Tue Jul 11 16:57:19 UTC 2000


On Mon, Jul 10, 2000 at 07:27:35PM -0700, Matt Kraai wrote:
> Howdy,
> 
> This page consolidates the code that is common to grep and sed for
> compiling regular expressions.  It also reworks the way sed s///
> commands are parsed in order to handle the `i' flag.
> 
> Matt

Thanks, Matt, this looks great. I have applied the patch with the following
modifications:

 - I still want to call exit_sed() in sed.c rather than fatalError because
   exit_sed() will in turn call destroy_cmd_strs() to free the dynamically
   allocated sed_cmds array.

 - I changed bb_regcomp() to return the int value returned from libc regcomp()
   (rather than it being a void function that calls exit(1) on failure) so
   that calling apps can do their own error handling. (In the case of sed, for
   example, I want to call exit_sed() if bb_regcomp() fails, for reasons
   mentioned already. BTW: I think bb_regcomp() is a great function name and
   the bb_* prefix is a convention we should follow more often, esp in
   utility.c.

 - Thanks for adding the feature to do case-insensitive matching in s///
   expressions. I have changed the s/ flag from 'i' to 'I' so as to A) bring
   our sed into closer compliance with GNU sed and B) remove any confusion /
   conflict with the (i)nsert command found in GNU/POSIX sed.

 - Some other very small / cosmetic cleanups & mods: more cruft removal from
   sed.c and putting "bb_regcomp" in the format string passed to errMsg() in
   the bb_regcomp() function.

BTW, I noticed you cleaned up some of my cruft from when I was developing sed
off-line. Thanks for that, too.

Cheers,

Mark Whitley
markw at lineo.com





More information about the busybox mailing list