2000-05-28 13:40:48 +00:00
|
|
|
/*
|
|
|
|
* vfprintf.c
|
|
|
|
*
|
|
|
|
* Ullrich von Bassewitz, 11.08.1998
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "_printf.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-08-14 22:16:40 +00:00
|
|
|
static void out (struct outdesc* d, const char* buf, unsigned count)
|
2000-05-28 13:40:48 +00:00
|
|
|
/* Routine used for writing */
|
|
|
|
{
|
|
|
|
/* Write to the file */
|
|
|
|
if (fwrite (buf, count, 1, (FILE*) d->ptr) == -1) {
|
|
|
|
d->ccount = -1;
|
|
|
|
} else {
|
|
|
|
d->ccount += count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-08-13 16:16:49 +00:00
|
|
|
int vfprintf (FILE* f, const char* format, va_list ap)
|
2000-05-28 13:40:48 +00:00
|
|
|
{
|
|
|
|
struct outdesc d;
|
|
|
|
|
|
|
|
/* Setup descriptor */
|
|
|
|
d.fout = out;
|
|
|
|
d.ptr = f;
|
|
|
|
|
|
|
|
/* Do formatting and output */
|
|
|
|
_printf (&d, format, ap);
|
|
|
|
|
|
|
|
/* Return bytes written */
|
|
|
|
return d.ccount;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-08-14 22:16:40 +00:00
|
|
|
|