summaryrefslogtreecommitdiff
path: root/src/stdio/snprintf.c
blob: c77239c4a60665f779d34c1ee11589002f5b4ce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "_stdio.h"

GCC_SSE_HACK
int snprintf(char * restrict s, size_t n, const char * restrict format, ...)
{
	SIGNAL_SAFE(0);
	ASSERT_NOOVERLAP(s, n, format, strlen(format));

	struct io_options opt = {
		.fnname = __func__,
		.string = s,
		.maxlen = n,
	};

	va_list ap;
	va_start(ap, format);
	int ret = __printf(&opt, format, ap);
	va_end(ap);

	return ret;
}

/*
STDC(199901)
*/