[BusyBox] Newline doesn't match $

Mark Whitley markw at lineo.com
Thu Jun 15 20:16:20 UTC 2000


I should have replied to this one awhile ago. Here 'tis.

On Tue, Jun 13, 2000 at 05:59:29PM -0600, Erik Andersen wrote:
> 
> Tell you what.  Lets not reinvent the wheel.  GNU libc has regexp support.
> Libc5 has regexp support.  I just double checked and uC-libc has regexp
> support.  

[snip]

> what would and would not be "allowed" in BusyBox.  regexp was not going to
> be included.  getopt was not going to be included.  glibc nss would not be
> included.  etc. 

[snip]

> The point of all this, is that I now believe the right solution is to use
> the libc provided regexp support and throw away the stuff currently in
> BusyBox.

Now that you mention it, using the existing, standard regex routines that are
available in *libc, I think that would be *much* better than us reinventing
the wheel. More standard, more portable, less code we have to write, smaller
executable image for busybox, [fill in your favorite advantage here].

Therefore, I will change the scope of what I was planning to do: I'll
massage/edit grep.c & sed.c to use the std libc regex routines instead of the
home-brew ones. It might require some rework of some of the existing grep
code, given the different semantics (as well as interfaces) of the regex
routines.

Any / all of this work will be delayed until after the 0.44 release.

> Well, now that I believe that uC-libc is the One True embedded libc, it
> turns out that it supports some things that were in my "to-be-avoided" list,
> like regular expressions, and getopt (but not getopt_long) support...  

Yes, but I think that we can all agree that uC-libc is going to need plenty of
work before it's ready for production use. With that in mind, I'll test
reworks to busybox grep/sed against GNU libc, as it is a stable target. Once
it's done, we can work on getting uC-libc regex routines up to snuff.

> It is probably the right move to switch to using getopt as well.

Agreed. We're not making busybox any smaller by duplicating option parsing
routines in every *_main() function. Additionally, reinventing option parsing
in every *_main() has been the source of a lot of bugs.

While we're on this topic, another common routine we could use is something
that checks the number of cmd-line arguments and prints an error/exits when
there are no args left. Something as simple as;

	#define bb_need_too_few_args

	void fail_if_no_args(int argc, char **argv, char *progname)
	{
		if (argc <=0 || *argv == NULL) {
			fprintf(stderr, too_few_args, progname);
			exit(-1);
		}
	}

would be great.

My $0.02.

Mark Whitley
markw at lineo.com






More information about the busybox mailing list