summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stdio/snprintf.c12
-rw-r--r--src/stdio/vsnprintf.c10
-rw-r--r--src/wchar/vfwprintf.c2
3 files changed, 22 insertions, 2 deletions
diff --git a/src/stdio/snprintf.c b/src/stdio/snprintf.c
index bc6df080..acf234b1 100644
--- a/src/stdio/snprintf.c
+++ b/src/stdio/snprintf.c
@@ -1,7 +1,19 @@
#include <stdio.h>
+#include "stdarg.h"
+#include "nonstd/io.h"
int snprintf(char * restrict s, size_t n, const char * restrict format, ...)
{
+ int ret = 0;
+ va_list ap;
+ struct io_options opt = {0};
+ opt.fnname = __func__;
+ opt.string = s;
+ opt.maxlen = n;
+ va_start(ap, format);
+ ret = __printf(&opt, format, ap);
+ va_end(ap);
+ return ret;
}
/*
diff --git a/src/stdio/vsnprintf.c b/src/stdio/vsnprintf.c
index 7c5a1e03..f54a15a1 100644
--- a/src/stdio/vsnprintf.c
+++ b/src/stdio/vsnprintf.c
@@ -1,8 +1,16 @@
#include <stdio.h>
#include "stdarg.h"
+#include "nonstd/io.h"
-int vsnprintf(char * restrict s, size_t n, va_list ap)
+int vsnprintf(char * restrict s, size_t n, const char *format, va_list arg)
{
+ int ret = 0;
+ struct io_options opt = {0};
+ opt.fnname = "fprintf";
+ opt.string = s;
+ opt.maxlen = n;
+ ret = __printf(&opt, format, arg);
+ return ret;
}
/*
diff --git a/src/wchar/vfwprintf.c b/src/wchar/vfwprintf.c
index 55662dff..df9ab381 100644
--- a/src/wchar/vfwprintf.c
+++ b/src/wchar/vfwprintf.c
@@ -10,7 +10,7 @@ int vfwprintf(FILE * restrict stream, const wchar_t * restrict format, va_list a
struct io_options opt = {0};
opt.fnname = "vfwprintf";
opt.stream = stream;
- ret = __printf(&opt, NULL /* format */, arg);
+ ret = __printf(&opt, (const char*)format, arg);
return ret;
}