conterm/libc/vfprint.c

20 lines
295 B
C
Raw Permalink Normal View History

2006-01-17 16:22:03 +03:00
#include <u.h>
#include <libc.h>
2006-01-17 15:37:52 +03:00
#include "fmtdef.h"
2005-08-08 16:50:13 +04: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 15:37:52 +03:00
VA_COPY(f.args,args);
2005-08-08 16:50:13 +04:00
n = dofmt(&f, fmt);
2006-01-17 15:37:52 +03:00
VA_END(f.args);
if(n > 0 && __fmtFdFlush(&f) == 0)
2005-08-08 16:50:13 +04:00
return -1;
return n;
}