Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/modules/klibc/vfprintf.c

Source at commit 1406 created 12 years 10 months ago.
By meklort, Revert drivers.c so that kexts are only loaded when OSBundleRequired is set and that value is not safe mode. Added some comments about it too.
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_SIZE32768
11
12extern size_t _fwrite(const void *buf, size_t count, FILE *f);
13
14int vfprintf(FILE * file, const char *format, va_list ap)
15{
16int rv;
17char buffer[BUFFER_SIZE];
18
19rv = vsnprintf(buffer, BUFFER_SIZE, format, ap);
20
21if (rv < 0)
22return rv;
23
24if (rv > BUFFER_SIZE - 1)
25rv = BUFFER_SIZE - 1;
26
27return _fwrite(buffer, rv, file);
28}
29

Archive Download this file

Revision: 1406