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

char*
fmt·vesprint(char *buf, char *end, char *fmt, va_list args)
{
    fmt·State io;

    if(end <= buf)
        return nil;

    io.n = 0;
    io.buffer.beg = io.buffer.cur = buf;
    io.buffer.end = end-1;
    io.flush = nil;
    io.file  = nil;

    va_copy(io.args, args);

    fmt·setlocale(&io, nil, nil, nil);
    fmt·do(&io, fmt);

    va_end(io.args);

    *(io.buffer.cur) = 0;
    return io.buffer.cur;
}