Starship/src/libc_sprintf.c
petrie911 7eff38a5f9
Add quick boot and add ram editing to object ram watch (#236)
* upgrades

* one cleanup

* streamlining

* whoops mods

* more ub

* cast cleanup
2024-05-08 15:57:11 -03:00

32 lines
638 B
C

#include "sys.h"
char D_800C7C80[] = "$Id: sprintf.c,v 1.5 1997/03/19 02:28:53 hayakawa Exp $";
char* proutSprintf(char* dst, const char* fmt, size_t size) {
return (char*) ((uintptr_t) memcpy(dst, fmt, size) + size);
}
s32 vsprintf(char* dst, const char* fmt, va_list args) {
s32 ret = _Printf(proutSprintf, dst, fmt, args);
if (ret > -1) {
dst[ret] = 0;
}
return ret;
}
int sprintf(char* s, const char* fmt, ...) {
s32 ret;
va_list args;
va_start(args, fmt);
ret = _Printf(proutSprintf, s, fmt, args);
if (ret >= 0) {
s[ret] = 0;
}
va_end(args);
return ret;
}