summaryrefslogtreecommitdiff
path: root/src/stdio/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/sprintf.c')
-rw-r--r--src/stdio/sprintf.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/stdio/sprintf.c b/src/stdio/sprintf.c
index 9e651adb..d6776fe4 100644
--- a/src/stdio/sprintf.c
+++ b/src/stdio/sprintf.c
@@ -1,15 +1,9 @@
+#include <stdarg.h>
#include <stdio.h>
-#include "stdarg.h"
#include "_stdio.h"
-#if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
-#include "stdint.h"
-#else
-#include "limits.h"
-#define SIZE_MAX INT_MAX
-#endif
-
/** write formatted output to a string **/
+
int sprintf(char * restrict s, const char * restrict format, ...)
{
int ret = 0;
@@ -17,7 +11,7 @@ int sprintf(char * restrict s, const char * restrict format, ...)
struct io_options opt = {0};
opt.fnname = "sprintf";
opt.string = s;
- opt.maxlen = SIZE_MAX;
+ opt.maxlen = (size_t)-1;
va_start(ap, format);
ret = __printf(&opt, format, ap);
va_end(ap);
@@ -32,6 +26,7 @@ writes a formatted string to the buffer at ARGUMENT(s). The format of
ARGUMENT(format) and the variadic arguments is the same as that for
FUNCTION(printf).
***/
+
/*
STDC(1)
*/