# HG changeset patch # User Matti Hamalainen # Date 1456134545 -7200 # Node ID 15e2ee6c7bfc74ce8ee1b1a1388f014b869c9d2d # Parent a6088507317b0115b91c0e6ac825992f75487c4f Add th_printf_ctx.ipos and use it for return values. It's a hack. :S diff -r a6088507317b -r 15e2ee6c7bfc th_string.c --- a/th_string.c Mon Feb 22 11:48:23 2016 +0200 +++ b/th_string.c Mon Feb 22 11:49:05 2016 +0200 @@ -362,7 +362,7 @@ } out: - return ret == EOF ? ret : ctx->pos; + return ret == EOF ? ret : ctx->ipos; } @@ -372,6 +372,7 @@ if (ctx->pos < ctx->size) ctx->buf[ctx->pos] = ch; ctx->pos++; + ctx->ipos++; return ch; } @@ -379,6 +380,7 @@ static int th_stdio_vputch(th_printf_ctx *ctx, const char ch) { ctx->pos++; + ctx->ipos++; return fputc(ch, (FILE *) ctx->data); } #endif diff -r a6088507317b -r 15e2ee6c7bfc th_string.h --- a/th_string.h Mon Feb 22 11:48:23 2016 +0200 +++ b/th_string.h Mon Feb 22 11:49:05 2016 +0200 @@ -52,6 +52,7 @@ { char *buf; size_t size, pos; + int ipos; void *data; } th_printf_ctx;