[BusyBox] modified libbb/arith.c -- size reduction (30%) and bug fix

Vladimir N. Oleynik dzo at simtreas.ru
Sun Aug 26 03:20:16 UTC 2001


Aaron,
 
> On Sat, Aug 25, 2001 at 04:22:43PM -0600, Manuel Novoa III wrote:
> > > I already long think, whether it is necessary to add to this module an
> > > opportunity of work
> > > with variables with standart syntax which does not demand for arithmetic
> > > operations of
> > > the symbol '$'? ( echo $((a+b)) eq echo $(($a+$b)) ) ...
> >
> > Perhaps arith() could be passed a function pointer for a function that
> > returns the numeric value of the variable name passed?  The modifications
> > arith() would need to handle $varname wouldn't be difficult in that case.
> 
> Eh?
> 
> $ ./busybox ash
> 
> BusyBox v0.60.0 (2001.08.22-00:05+0000) Built-in shell (ash)
> Enter 'help' for a list of built-in commands.
> 
> $ foo=1
> $ bar=2
> $ echo $(($foo+$bar))
> 3
> $

As far as I can judge, Manuel have deciphered all correctly. 
We add function lookupvar() a line and by analogy as an equivalent isdigit()
and we shall receive working standart syntax:  


$ foo=1
$ bar=2
$ echo $(($foo+$bar))
3
$ echo $((foo+bar))
3
$


--w
vodz





More information about the busybox mailing list