@@@ man wip
[mLib] / test / tvec-output.c
index 8c9c214..cacd94c 100644 (file)
@@ -673,7 +673,8 @@ static int human_nwritef(void *go, size_t maxsz, const char *p, ...)
   va_start(ap, p);
   n = gprintf_memputf(&h->outbuf, &h->outsz, maxsz, p, ap);
   va_end(ap);
-  return (layout_string(&h->lyt, h->outbuf, n));
+  if (layout_string(&h->lyt, h->outbuf, n)) return (-1);
+  return (n);
 }
 
 static const struct gprintf_ops human_printops =
@@ -1273,10 +1274,20 @@ struct tap_output {
  */
 
 static int tap_writech(void *go, int ch)
-  { struct tap_output *t = go; return (layout_char(&t->lyt, ch)); }
+{
+  struct tap_output *t = go;
+
+  if (layout_char(&t->lyt, ch)) return (-1);
+  else return (1);
+}
 
 static int tap_writem(void *go, const char *p, size_t sz)
-  { struct tap_output *t = go; return (layout_string(&t->lyt, p, sz)); }
+{
+  struct tap_output *t = go;
+
+  if (layout_string(&t->lyt, p, sz)) return (-1);
+  else return (sz);
+}
 
 static int tap_nwritef(void *go, size_t maxsz, const char *p, ...)
 {
@@ -1287,7 +1298,8 @@ static int tap_nwritef(void *go, size_t maxsz, const char *p, ...)
   va_start(ap, p);
   n = gprintf_memputf(&t->outbuf, &t->outsz, maxsz, p, ap);
   va_end(ap);
-  return (layout_string(&t->lyt, t->outbuf, n));
+  if (layout_string(&t->lyt, t->outbuf, n)) return (-1);
+  return (n);
 }
 
 static const struct gprintf_ops tap_printops =