chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
utils/gprintf.c: Return the correct number of output characters.
[mLib]
/
utils
/
gprintf.c
diff --git
a/utils/gprintf.c
b/utils/gprintf.c
index b575e1f4ef495d148cf6cb16e57c69822b599d8b..8825bd1072cc3ec2327513a503f017f2d0ea40e2 100644
(file)
--- a/
utils/gprintf.c
+++ b/
utils/gprintf.c
@@
-416,9
+416,13
@@
int vgprintf(const struct gprintf_ops *ops, void *out,
if (fs->fmt == fmt_unset) {
switch (fs->ch) {
if (fs->fmt == fmt_unset) {
switch (fs->ch) {
- case 0: break;
- case '%': ops->putch(out, '%'); break;
- default: abort();
+ case 0:
+ break;
+ case '%':
+ if (ops->putch(out, '%')) return (-1);
+ tot++; break;
+ default:
+ abort();
}
continue;
}
}
continue;
}
@@
-497,7
+501,7
@@
int vgprintf(const struct gprintf_ops *ops, void *out,
#else
# define MSG "<no float support>"
if (ops->putm(out, MSG, sizeof(MSG) - 1)) return (-1);
#else
# define MSG "<no float support>"
if (ops->putm(out, MSG, sizeof(MSG) - 1)) return (-1);
- continue;
+
tot += sizeof(MSG) - 1;
continue;
# undef MSG
#endif
case 's':
# undef MSG
#endif
case 's':