summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/stream.c b/stream.c
index b7945e42..b57a57b1 100644
--- a/stream.c
+++ b/stream.c
@@ -775,7 +775,12 @@ val vformat(val stream, val fmtstr, va_list vl)
} else {
width = digits;
}
- state = (ch == ',') ? vf_precision : vf_spec;
+ if (ch == ',') {
+ state = vf_precision;
+ } else {
+ state = vf_spec;
+ --fmt;
+ }
continue;
case vf_precision:
precision = digits;
@@ -827,7 +832,7 @@ val vformat(val stream, val fmtstr, va_list vl)
if (nump(obj)) {
value = c_num(obj);
sprintf(num_buf, "%ld", value);
- if (vformat_num(stream, num_buf, 0, 0, 0, 0))
+ if (!vformat_num(stream, num_buf, 0, 0, 0, 0))
return nil;
continue;
}