summaryrefslogtreecommitdiff
path: root/riscv/riscv-probe/libfemto/std/vprintf.c
blob: 36c99a382e7820dcfbabf5074a7f5a3ebcec23b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// See LICENSE for license details.

#include <stdio.h>
#include <alloca.h>

int vprintf(const char* s, va_list vl)
{
    char *out;
    int res = vsnprintf(NULL, -1, s, vl);
    out = alloca(res + 1);
    vsnprintf(out, res + 1, s, vl);
    while (*out) putchar(*out++);
    return res;
}