X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/31d0247cc58abc0b0720aa7e9972011c5a66995c..d056fbdff1c5a26be055c38eee4c273ee6a0cba7:/test/tvec-output.c?ds=inline diff --git a/test/tvec-output.c b/test/tvec-output.c index 5210d11..cacd94c 100644 --- a/test/tvec-output.c +++ b/test/tvec-output.c @@ -416,38 +416,6 @@ static int layout_string(struct layout *lyt, const char *p, size_t sz) #undef PUT_CHAR #undef SAVE_PFXTAIL -/*----- Skeleton ----------------------------------------------------------*/ -/* -static void ..._bsession(struct tvec_output *o, struct tvec_state *tv) -static int ..._esession(struct tvec_output *o) -static void ..._bgroup(struct tvec_output *o) -static void ..._skipgroup(struct tvec_output *o, - const char *excuse, va_list *ap) -static void ..._egroup(struct tvec_output *o) -static void ..._btest(struct tvec_output *o) -static void ..._skip(struct tvec_output *o, const char *excuse, va_list *ap) -static void ..._fail(struct tvec_output *o, const char *detail, va_list *ap) -static void ..._dumpreg(struct tvec_output *o, unsigned disp, - union tvec_regval *rv, const struct tvec_regdef *rd) -static void ..._etest(struct tvec_output *o, unsigned outcome) -static void ..._bbench(struct tvec_output *o, - const char *ident, unsigned unit) -static void ..._ebench(struct tvec_output *o, - const char *ident, unsigned unit, - const struct tvec_timing *t) -static void ..._error(struct tvec_output *o, const char *msg, va_list *ap) -static void ..._notice(struct tvec_output *o, const char *msg, va_list *ap) -static void ..._destroy(struct tvec_output *o) - -static const struct tvec_outops ..._ops = { - ..._bsession, ..._esession, - ..._bgroup, ..._egroup, ..._skip, - ..._btest, ..._skip, ..._fail, ..._dumpreg, ..._etest, - ..._bbench, ..._ebench, - ..._error, ..._notice, - ..._destroy -}; -*/ /*----- Human-readable output ---------------------------------------------*/ /* Attributes for colour output. This should be done better, but @terminfo@ @@ -705,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 = @@ -1305,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, ...) { @@ -1319,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 =