chiark / gitweb /
@@@ tvec doc wip
[mLib] / utils / gprintf.c
index b575e1f4ef495d148cf6cb16e57c69822b599d8b..602698cdbbd096d1a4f1fedfd0df4d466060038b 100644 (file)
@@ -373,7 +373,7 @@ int vgprintf(const struct gprintf_ops *ops, void *out,
        break;
       default:
        fprintf(stderr,
-               "FATAL dstr_vputf: unknown format specifier `%c'\n", p[-1]);
+               "FATAL vgprintf: unknown format specifier `%c'\n", p[-1]);
        abort();
     }
 
@@ -416,9 +416,13 @@ int vgprintf(const struct gprintf_ops *ops, void *out,
 
     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;
     }
@@ -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);
-       continue;
+       tot += sizeof(MSG) - 1; continue;
 #  undef MSG
 #endif
       case 's':