blob: 7ded9082f462ecb6a20dd967a7ef8eebafecc7b5 (
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"
int
fmt·vnsprint(int len, char *buf, char *fmt, va_list args)
{
fmt·State io;
if(len <= 0)
return -1;
io.n = 0;
io.buffer.beg = io.buffer.cur = buf;
io.buffer.end = buf+len-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 - io.buffer.beg;
}
|