2021-05-09 17:34:00 +02:00
|
|
|
#include <stdio.h>
|
2021-06-07 18:57:11 +02:00
|
|
|
#include <fxlibc/printf.h>
|
2020-09-17 19:27:01 +02:00
|
|
|
|
2021-06-07 18:57:11 +02:00
|
|
|
int snprintf(char * restrict str, size_t size, char const * restrict fmt, ...)
|
2020-09-17 19:27:01 +02:00
|
|
|
{
|
2021-06-07 18:57:11 +02:00
|
|
|
/* This is valid even if str=NULL. */
|
|
|
|
struct __printf_output out = {
|
|
|
|
.str = str,
|
|
|
|
.size = size,
|
|
|
|
};
|
2020-09-17 19:27:01 +02:00
|
|
|
|
2021-06-07 18:57:11 +02:00
|
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
|
|
|
|
|
|
int count = __printf(&out, fmt, &args);
|
|
|
|
|
|
|
|
va_end(args);
|
|
|
|
return count;
|
2020-09-17 19:27:01 +02:00
|
|
|
}
|