[BusyBox] Arith in ash

Erik Andersen andersen at lineo.com
Thu Jun 28 09:29:14 UTC 2001


On Thu Jun 28, 2001 at 03:09:52AM -0700, Aaron Lehmann wrote:
> I noticed this in the new ash.c:
> 
> 
> 	/* The generated file arith.c has been snipped. 
> 
> 	....
> 
> Arithmetic support is needed for POSIX shell compliance, in
> expressions such as $((...)). The other day I rewrote arith_lex.l, the
> arith lexer, in C. This saved about 5 kilobytes on i386, since lex
> doesn't generate good code. To keep arith support in busybox's ash,
> you could use this lexer and port the small yacc grammar to C. This
> wouldn't be to hard - it just takes a stack. I may voulenteer to do
> it.

Volunteers always welcome.  I disabled that stuff since the generated
code was horrible, and since it required linking vs libfl (busybox
has a policy of only linking vs libc).

> Also, command line editing and history is a great feature. Take a look
> at hetio.c in a recent Debian version of ash. This code allegedly adds
> less than 3k to an i386 binary. Actually, wait a few days before
> looking because I have an important patch to hetio.c pending ;-).

If you looks closely, the command line editing already in busybox is
_much_ better then the hetio stuff.  The only thing lacking is hooking
into the busybox cmdedit stuff to implement the fc builtin.

> Here's the yylex that I ported to C, improved on by Herbert Xu:
> 
> 
> int
> yylex()

Cool, this looks much cleaner.

 -Erik

--
Erik B. Andersen   email:  andersen at lineo.com
--This message was written using 73% post-consumer electrons--





More information about the busybox mailing list