summaryrefslogtreecommitdiff
path: root/src/libc/stdio/sprintf.c
blob: 0bfbb17370d56489c0ff47bf9cc55a72a3ae7344 (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 <camellia/syscalls.h>
#include <shared/mem.h>
#include <shared/printf.h>
#include <stdio.h>

int sprintf(char *restrict s, const char *restrict fmt, ...) {
	int ret;
	va_list argp;
	va_start(argp, fmt);
	ret = vsnprintf(s, ~0, fmt, argp);
	va_end(argp);
	return ret;
}

int vsprintf(char *restrict s, const char *restrict fmt, va_list ap) {
	return vsnprintf(s, ~0, fmt, ap);
}

int _klogf(const char *fmt, ...) {
	char buf[256];
	int ret;
	va_list argp;
	va_start(argp, fmt);
	ret = vsnprintf(buf, sizeof buf, fmt, argp);
	va_end(argp);
	_sys_debug_klog(buf, ret);
	return ret;
}