Root/
Source at commit 1275 created 12 years 11 months ago. By meklort, Remove unused file. Fixup makefiles some more - boot2 compiles again. | |
---|---|
1 | /*␊ |
2 | * vfprintf.c␊ |
3 | */␊ |
4 | ␊ |
5 | #include <stdio.h>␊ |
6 | #include <string.h>␊ |
7 | #include <stdarg.h>␊ |
8 | #include <unistd.h>␊ |
9 | ␊ |
10 | #define BUFFER_SIZE␉32768␊ |
11 | ␊ |
12 | extern size_t _fwrite(const void *buf, size_t count, FILE *f);␊ |
13 | ␊ |
14 | int vfprintf(FILE * file, const char *format, va_list ap)␊ |
15 | {␊ |
16 | ␉int rv;␊ |
17 | ␉char buffer[BUFFER_SIZE];␊ |
18 | ␊ |
19 | ␉rv = vsnprintf(buffer, BUFFER_SIZE, format, ap);␊ |
20 | ␊ |
21 | ␉if (rv < 0)␊ |
22 | ␉␉return rv;␊ |
23 | ␊ |
24 | ␉if (rv > BUFFER_SIZE - 1)␊ |
25 | ␉␉rv = BUFFER_SIZE - 1;␊ |
26 | ␊ |
27 | ␉return _fwrite(buffer, rv, file);␊ |
28 | }␊ |
29 |