You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
+#ifdef __ds390
#define USE_FLOATS 1
+#endif
#include <stdarg.h>
#include <string.h>
/* this one NEEDS to be in data */
static data value_t value;
-static unsigned short radix;
+static unsigned char radix;
+
+// jwk: TODO: this makes the whole dammed thing nonreentrent
+static int charsOutputted;
/****************************************************************************/
{
putchar( c );
}
+ charsOutputted++;
}
/*--------------------------------------------------------------------------*/
signed char reqDecimals,
bit left, bit zero, bit sign, bit space)
{
- XSPEC char negative=0;
- XSPEC long integerPart;
- XSPEC float decimalPart;
- XSPEC char fpBuffer[128];
- XSPEC char fpBI=0, fpBD;
- XSPEC unsigned char minWidth, i;
+ char negative=0;
+ long integerPart;
+ float decimalPart;
+ char fpBuffer[128];
+ char fpBI=0, fpBD;
+ unsigned char minWidth, i;
// save the sign
if (f<0) {
bit long_argument;
bit float_argument;
- XSPEC unsigned char width;
- XSPEC signed char decimals;
- XSPEC unsigned char length;
- XSPEC char c;
+ unsigned char width;
+ signed char decimals;
+ unsigned char length;
+ char c;
+
+ // reset output chars
+ charsOutputted=0;
output_ptr = buf;
if ( !buf )
goto get_conversion_spec;
case 'C':
- output_char( va_arg(ap,unsigned char) );
+ output_char( va_arg(ap,int) );
break;
case 'S':
// 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;
+ }
}
/*--------------------------------------------------------------------------*/