xref: /plan9/sys/src/libc/fmt/fmtprint.c (revision ec59a3ddbfceee0efe34584c2c9981a5e5ff1ec4)
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
12 fmtprint(Fmt *f, char *fmt, ...)
13 {
14 	va_list va;
15 	int n;
16 
17 	f->flags = 0;
18 	f->width = 0;
19 	f->prec = 0;
20 	va = f->args;
21 	va_start(f->args, fmt);
22 	n = dofmt(f, fmt);
23 	va_end(f->args);
24 	f->flags = 0;
25 	f->width = 0;
26 	f->prec = 0;
27 	f->args = va;
28 	if(n >= 0)
29 		return 0;
30 	return n;
31 }
32 
33