about summary refs log tree commit diff
path: root/Functions/Misc/zcalc
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-08-16 16:42:21 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-08-16 16:42:21 +0000
commit91ef933eb3447dc3fcccbe2b9107397410364531 (patch)
tree97cd5df53e960899e0fa07fb8bed578f14e96d8f /Functions/Misc/zcalc
parent0f880152fc5f1ea1b9f6207bc3c50b80f0730e45 (diff)
downloadzsh-91ef933eb3447dc3fcccbe2b9107397410364531.tar.gz
zsh-91ef933eb3447dc3fcccbe2b9107397410364531.tar.xz
zsh-91ef933eb3447dc3fcccbe2b9107397410364531.zip
Fix problem with output bases in zcalc
Diffstat (limited to 'Functions/Misc/zcalc')
-rw-r--r--Functions/Misc/zcalc7
1 files changed, 5 insertions, 2 deletions
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