From: johanknol Date: Fri, 26 Jan 2001 20:01:32 +0000 (+0000) Subject: I'd rather flush the whole fucking (sorry) stdio and rewrite it from scratch X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=75cfabdb04b00d77a0fb60edc94ea74052658c37;p=fw%2Fsdcc I'd rather flush the whole fucking (sorry) stdio and rewrite it from scratch git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@540 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/device/lib/vprintf.c b/device/lib/vprintf.c index 09f936ab..1409507e 100644 --- a/device/lib/vprintf.c +++ b/device/lib/vprintf.c @@ -72,6 +72,9 @@ static data value_t value; static unsigned short radix; +// jwk: TODO: this makes the whole dammed thing nonreentrent +static int charsOutputted; + /****************************************************************************/ static void output_char( char c ) reentrant @@ -84,6 +87,7 @@ static void output_char( char c ) reentrant { putchar( c ); } + charsOutputted++; } /*--------------------------------------------------------------------------*/ @@ -260,6 +264,9 @@ int vsprintf (const char *buf, const char *format, va_list ap) XSPEC unsigned char length; XSPEC char c; + // reset output chars + charsOutputted=0; + output_ptr = buf; if ( !buf ) { @@ -596,7 +603,12 @@ _endasm; // Copy \0 to the end of buf // Modified by JB 17/12/99 - if (output_to_string) output_char(0); + if (output_to_string) { + output_char(0); + return charsOutputted-1; + } else { + return charsOutputted; + } } /*--------------------------------------------------------------------------*/