diff th_string.c @ 279:15e2ee6c7bfc

Add th_printf_ctx.ipos and use it for return values. It's a hack. :S
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 22 Feb 2016 11:49:05 +0200
parents a6088507317b
children 454f0d37d94b
line wrap: on
line diff
--- 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