summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/vfprintf.c
blob: 0ebfd1561b23d705795116d399e63e0695a17c19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

int vfprintf(FILE *fstream, const char *format, va_list ap)
{
  char *tmp;
  size_t n=vsnprintf(0, 1000000, format, ap);
  tmp=alloca(n+2);
  if (tmp) {
    vsnprintf(tmp, n+1, format, ap);
    fwrite(tmp, n,1, fstream);
  }
  return n;
}