drawterm/libc/vfprint.c

20 lines
295 B
C
Raw Normal View History

2006-01-17 14:22:03 +01:00
#include <u.h>
#include <libc.h>
2006-01-17 13:37:52 +01:00
#include "fmtdef.h"
2005-08-08 14:50:13 +02:00
int
vfprint(int fd, char *fmt, va_list args)
{
Fmt f;
char buf[256];
int n;
fmtfdinit(&f, fd, buf, sizeof(buf));
2006-01-17 13:37:52 +01:00
VA_COPY(f.args,args);
2005-08-08 14:50:13 +02:00
n = dofmt(&f, fmt);
2006-01-17 13:37:52 +01:00
VA_END(f.args);
if(n > 0 && __fmtFdFlush(&f) == 0)
2005-08-08 14:50:13 +02:00
return -1;
return n;
}