xref: /plan9/sys/src/cmd/unix/drawterm/libc/fmtvprint.c (revision 2282df4ee19682a10ae95200202320ff2912f104)
1 #include <u.h>
2 #include <libc.h>
3 #include "fmtdef.h"
4 
5 
6 /*
7  * format a string into the output buffer
8  * designed for formats which themselves call fmt,
9  * but ignore any width flags
10  */
11 int
fmtvprint(Fmt * f,char * fmt,va_list args)12 fmtvprint(Fmt *f, char *fmt, va_list args)
13 {
14 	va_list va;
15 	int n;
16 
17 	f->flags = 0;
18 	f->width = 0;
19 	f->prec = 0;
20 	VA_COPY(va,f->args);
21 	VA_END(f->args);
22 	VA_COPY(f->args,args);
23 	n = dofmt(f, fmt);
24 	f->flags = 0;
25 	f->width = 0;
26 	f->prec = 0;
27 	VA_END(f->args);
28 	VA_COPY(f->args,va);
29 	VA_END(va);
30 	if(n >= 0)
31 		return 0;
32 	return n;
33 }
34 
35