mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-05-12 11:43:16 -04:00
libc: add actual sprintf to sprintf.c
Change-Id: Iba19b587781da3191c7674a6a141c0c4fbf8b344
This commit is contained in:
parent
25551180ba
commit
7ab521cba6
1 changed files with 18 additions and 0 deletions
|
|
@ -109,3 +109,21 @@ overflow:
|
|||
errno = EOVERFLOW;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int sprintf(char *buf, const char *fmt, ...)
|
||||
{
|
||||
int bytes;
|
||||
struct for_snprintf pr;
|
||||
va_list ap;
|
||||
|
||||
pr.ptr = buf;
|
||||
pr.rem = INT_MAX;
|
||||
|
||||
va_start(ap, fmt);
|
||||
bytes = vuprintf(sprfunc, &pr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
*pr.ptr = '\0';
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue