Add an itoa() function, following the most common prototype I can find.

This commit is contained in:
David Given 2019-06-24 20:52:56 +02:00
parent 9d0f03822c
commit 1bd6a9d4fa
2 changed files with 14 additions and 0 deletions

View file

@ -0,0 +1,13 @@
#include <stdio.h>
void itoa(long value, char* buffer, int radix)
{
if (value < 0)
{
*buffer++ = '-';
value = -value;
}
buffer = _i_compute(value, 10, buffer, 0);
*buffer++ = '\0';
}

View file

@ -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 <ack/emufile.h>