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

int
fmt·write(fmt·State *io, char *fmt, ...)
{
    int n;
    va_list args;

    io->flag = io->width = io->prec = 0;

    va_copy(args, io->args);
    va_end(io->args);

    va_start(io->args, fmt);
    n = fmt·do(io, fmt);
    va_end(io->args);

    io->flag = io->width = io->prec = 0;
    if(n >= 0)
        return 0;
    return n;
}