diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-10-12 04:51:54 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-10-12 04:51:54 +0200 |
commit | 7985bc109e0d738644094f391d08d9848a2f2b50 (patch) | |
tree | 7bc6aa3e04ebd86bbd8516bffe9e3c8b894534b9 /editors | |
parent | 1d30b3f1f66a0cd179f47082245079ef357b6a66 (diff) | |
download | busybox-7985bc109e0d738644094f391d08d9848a2f2b50.tar.gz |
awk: fix length(array)
function old new delta
evaluate 3526 3548 +22
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r-- | editors/awk.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/editors/awk.c b/editors/awk.c index 77784dfc1..8848d94a5 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -2784,8 +2784,16 @@ static var *evaluate(node *op, var *res) break; case F_le: - if (!op1) + debug_printf_eval("length: L.s:'%s'\n", L.s); + if (!op1) { L.s = getvar_s(intvar[F0]); + debug_printf_eval("length: L.s='%s'\n", L.s); + } + else if (L.v->type & VF_ARRAY) { + R_d = L.v->x.array->nel; + debug_printf_eval("length: array_len:%d\n", L.v->x.array->nel); + break; + } R_d = strlen(L.s); break; |