aboutsummaryrefslogtreecommitdiff
path: root/sys/libfmt/vfprint.c
blob: 4306ea786bc9d60c61867fc887dcc1018ec2a175 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "internal.h"

int
fmt·vfprint(int fd, char *fmt, va_list args)
{
    int  n;
    fmt·State io;
    char buf[256];

    fmt·open(fd, sizeof(buf), buf, &io);

    va_copy(io.args, args);
    n = fmt·do(&io, fmt);
    va_end(io.args);

    if(n > 0 && io.flush(&io) < 0)
        return -1;
    return n;
}