fmtvprint.c - 9base - revived minimalist port of Plan 9 userland to Unix | |
git clone git://git.suckless.org/9base | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
fmtvprint.c (625B) | |
--- | |
1 /* Copyright (c) 2002-2006 Lucent Technologies; see LICENSE */ | |
2 #include <stdarg.h> | |
3 #include <string.h> | |
4 #include "plan9.h" | |
5 #include "fmt.h" | |
6 #include "fmtdef.h" | |
7 | |
8 | |
9 /* | |
10 * format a string into the output buffer | |
11 * designed for formats which themselves call fmt, | |
12 * but ignore any width flags | |
13 */ | |
14 int | |
15 fmtvprint(Fmt *f, char *fmt, va_list args) | |
16 { | |
17 va_list va; | |
18 int n; | |
19 | |
20 f->flags = 0; | |
21 f->width = 0; | |
22 f->prec = 0; | |
23 VA_COPY(va,f->args); | |
24 VA_END(f->args); | |
25 VA_COPY(f->args,args); | |
26 n = dofmt(f, fmt); | |
27 f->flags = 0; | |
28 f->width = 0; | |
29 f->prec = 0; | |
30 VA_END(f->args); | |
31 VA_COPY(f->args,va); | |
32 VA_END(va); | |
33 if(n >= 0) | |
34 return 0; | |
35 return n; | |
36 } | |
37 |