[Fwd: Re: [BusyBox] Re: ash bug]
Vladimir N. Oleynik
dzo at simtreas.ru
Mon Aug 4 08:21:10 UTC 2003
I wrote:
>> dash have expr == let aliased.
>> Result: let is command for reduce $(()) syntax.
>> You should change your example to
>> x=`let 1`
New dash variant for busybox placed to my ftp:
ftp://ftp.simtreas.ru/pub/my/bb/new
News:
- rewroted let syntax as bash:
from bash man:
let arg [arg ...]
Each arg is an arithmetic expression to be evaluated (see ARITH-
METIC EVALUATION). If the last arg evaluates to 0, let returns 1;
0 is returned otherwise.
- rewroted arith:
* - allow access to variable,
* used recursive find value indirection (c=1; a="c"; $((a+=2)) produce 3)
* - realize assign syntax (VAR=expr, +=, *= etc)
* - realize exponentiation (** operator)
* - realize comma separated - expr, expr
* - realise ++expr --expr expr++ expr--
* - realise expr ? expr : expr (but, second expr calculate always)
* - allow hexdecimal and octal numbers
* - restore loses XOR operator
* - remove one goto label, added two ;-)
* - protect $((num num)) as true zero expr (Manuel`s error)
* - always use special isspace(), see comment from bash ;-)
Test:
unset a b c d
echo 'rez=$((cond = a=1+2*3 ? (1+2*3,b=2**3) : (c=2|1^5), 0x20-010+d++))'
rez=$((cond = a=1+2*3 ? (1+2*3,b=2**3) : (c=2|1^5), 0x20-010+d++))
echo 'a='$a 'b='$b 'c='$c 'cond='$cond 'rez='$rez 'd='$d
echo "compare with harcoded:"
echo 'a=7' 'b=8' 'c=6' 'cond=8' 'rez=24' 'd=1'
But arith code must remove from libbb, only dash used this functions and require
builtins dash *var* function now.
Manuel,
I wrote this 30 hours, but result size ~ + 900 bytes. I can`t found reduce size
presently. :-(
Herbert,
This arith code FULL realised bash expression, but less 1k size. I recomended
replace your
arith.y to this.
--w
vodz
More information about the busybox
mailing list