diff --git a/lang/cem/libcc.ansi/core/printf/itoa.c b/lang/cem/libcc.ansi/core/printf/itoa.c new file mode 100644 index 000000000..64104f50a --- /dev/null +++ b/lang/cem/libcc.ansi/core/printf/itoa.c @@ -0,0 +1,13 @@ +#include + +void itoa(long value, char* buffer, int radix) +{ + if (value < 0) + { + *buffer++ = '-'; + value = -value; + } + buffer = _i_compute(value, 10, buffer, 0); + *buffer++ = '\0'; +} + diff --git a/lang/cem/libcc.ansi/headers/stdio.h b/lang/cem/libcc.ansi/headers/stdio.h index c6ddb8808..45495d632 100644 --- a/lang/cem/libcc.ansi/headers/stdio.h +++ b/lang/cem/libcc.ansi/headers/stdio.h @@ -75,6 +75,7 @@ extern void perror(const char *_s); /* Internal function used in several places which is approximately itoa(). */ extern char *_i_compute(unsigned long val, int base, char *s, int nrdigits); +extern void itoa(long val, char* buffer, int radix); #if ACKCONF_WANT_EMULATED_FILE #include