mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-01-23 21:45:00 +03:00
7eff38a5f9
* upgrades * one cleanup * streamlining * whoops mods * more ub * cast cleanup
32 lines
638 B
C
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;
|
|
}
|