summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2016-10-09 23:25:34 -0400
committerJune McEnroe <june@causal.agency>2016-10-09 23:25:34 -0400
commit52728d584c2c25dabd87fa37e2d132b3bf5ed101 (patch)
treed8ea1726f99e6353895aa546ec3c70b02deb4250
parentRewrite jrp (diff)
downloadsrc-52728d584c2c25dabd87fa37e2d132b3bf5ed101.tar.gz
src-52728d584c2c25dabd87fa37e2d132b3bf5ed101.zip
Fix jrp snprintf len
I hate calculations like these.
Diffstat (limited to '')
-rwxr-xr-x.bin/jrp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/.bin/jrp.c b/.bin/jrp.c
index f3205924..cde2fcce 100755
--- a/.bin/jrp.c
+++ b/.bin/jrp.c
@@ -206,7 +206,7 @@ static char *prompt(EditLine *el __attribute((unused))) {
     static char buf[4096];
     char *bufPtr = buf;
     for (qvalue *stackPtr = stack.limit - 1; stackPtr >= stack.ptr; --stackPtr) {
-        size_t bufLen = sizeof(buf) - (buf - bufPtr) - 2;
+        size_t bufLen = sizeof(buf) - (bufPtr - buf) - 2;
         switch (radix) {
             case 2:  bufPtr += snprintf(bufPtr, bufLen, " %s", formatBin(*stackPtr)); break;
             case 8:  bufPtr += snprintf(bufPtr, bufLen, " %lo", *stackPtr); break;