Adding upstream version 3.35.
[syslinux-debian/hramrach.git] / com32 / lib / vfprintf.c
blob39cf9838f696dc1037d29b3d77c66475d2c5be82
1 /*
2 * vfprintf.c
3 */
5 #include <stdio.h>
6 #include <string.h>
7 #include <stdarg.h>
8 #include <unistd.h>
10 #define BUFFER_SIZE 32768
12 int vfprintf(FILE *file, const char *format, va_list ap)
14 int rv;
15 char buffer[BUFFER_SIZE];
17 rv = vsnprintf(buffer, BUFFER_SIZE, format, ap);
19 if ( rv < 0 )
20 return rv;
22 if ( rv > BUFFER_SIZE-1 )
23 rv = BUFFER_SIZE-1;
25 return _fwrite(buffer, rv, file);