vfprint.c (386B) download
1/* Copyright (c) 2002-2006 Lucent Technologies; see LICENSE */
2#include "fmt.h"
3#include "fmtdef.h"
4#include "plan9.h"
5
6#include <stdarg.h>
7
8int vfprint(int fd, char* fmt, va_list args) {
9 Fmt f;
10 char buf[256];
11 int n;
12
13 fmtfdinit(&f, fd, buf, sizeof(buf));
14 VA_COPY(f.args, args);
15 n = dofmt(&f, fmt);
16 VA_END(f.args);
17 if (n > 0 && __fmtFdFlush(&f) == 0)
18 return -1;
19 return n;
20}