bug#1008: [BusyBox] bug#1008: Fix
Mark Whitley
markw at lineo.com
Mon Jul 10 15:56:26 UTC 2000
On Mon, Jul 10, 2000 at 02:10:11AM -0700, Matt Kraai wrote:
> Howdy,
>
> Erik had apparently already ported grep to use the standard regular
> expression library. However, the case of
>
> grep foo$ file
>
> didn't work, due to a problem with the flags used in regular expression
> compilation. The attached patch fixes this problem.
>
> Matt
> Index: grep.c
> ===================================================================
> RCS file: /var/cvs/busybox/grep.c,v
> retrieving revision 1.30
> diff -u -r1.30 grep.c
> --- grep.c 2000/07/04 22:17:01 1.30
> +++ grep.c 2000/07/10 08:57:04
> @@ -141,8 +141,10 @@
> if (argv[optind] == NULL)
> usage(grep_usage);
>
> - /* compile the regular expression */
> - reflags = REG_NOSUB; /* we're not going to mess with sub-expressions */
> + /* compile the regular expression
> + * we're not going to mess with sub-expressions, and we need to
> + * treat newlines right. */
> + reflags = REG_NOSUB | REG_NEWLINE;
> if (ignore_case)
> reflags |= REG_ICASE;
> if ((ret = regcomp(®ex, argv[optind], reflags)) != 0) {
Thanks for finding and fixing this, Matt. 'grep foo$' was one of the things
broken in the previous version of grep and one of the things I hoped to fix
with the rewrite. Looks like I overlooked this (my bad). Thanks for catching
this one! I have applied your patch and checked it into CVS.
Muchas gracias,
Mark Whitley
markw at lineo.com
More information about the busybox
mailing list