diff options
Diffstat (limited to 'lib/ultralib/src/libc/sprintf.c')
| -rwxr-xr-x | lib/ultralib/src/libc/sprintf.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/ultralib/src/libc/sprintf.c b/lib/ultralib/src/libc/sprintf.c new file mode 100755 index 0000000..8d619f5 --- /dev/null +++ b/lib/ultralib/src/libc/sprintf.c @@ -0,0 +1,24 @@ +#include "xstdio.h" +#include "string.h" + +// TODO: this comes from a header +#ident "$Revision: 1.23 $" + +static char *proutSprintf(char *dst, const char *src, size_t count); + +int sprintf(char *dst, const char *fmt, ...) +{ + s32 ans; + va_list ap; + va_start(ap, fmt); + ans = _Printf(proutSprintf, dst, fmt, ap); + if (ans >= 0) + { + dst[ans] = 0; + } + return ans; +} +static char *proutSprintf(char *dst, const char *src, size_t count) +{ + return (char *)memcpy((u8 *)dst, (u8 *)src, count) + count; +} |
