From 91ef933eb3447dc3fcccbe2b9107397410364531 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 16 Aug 2001 16:42:21 +0000 Subject: Fix problem with output bases in zcalc --- ChangeLog | 5 +++++ Functions/Misc/zcalc | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47828857b..d73b34355 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-08-16 Peter Stephenson + + * 15647: Functions/Misc/zcalc: with output not showing the + base (e.g. [##16]) reuse of previous values didn't work. + 2001-08-16 Sven Wischnowsky * 15639: Src/text.c: fix bug for output of unquoted here-docs and diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc index 503bcb94b..d9d1fb91b 100644 --- a/Functions/Misc/zcalc +++ b/Functions/Misc/zcalc @@ -135,10 +135,13 @@ while vared -cehp "${(%)ZCALCPROMPT}" line; do # Latest value is stored as a string, because it might be floating # point or integer --- we don't know till after the evaluation, and # arrays always store scalars anyway. - eval "latest=\$(( $base $line ))" + # + # Since it's a string, we'd better make sure we know which + # base it's in, so don't change that until we actually print it. + eval "latest=\$(( $line ))" argv[num++]=$latest psvar[1]=$num - print -- $latest + print -- $(( $base $latest )) fi line= done -- cgit 1.4.1