xref: /plan9-contrib/sys/src/libstdio/vsnprintf.c (revision 6a9fc400c33447ef5e1cda7185cb4de2c8e8010e)
1 /*
2  * pANS stdio -- vsnprintf
3  */
4 #include "iolib.h"
5 int vsnprintf(char *buf, int nbuf, const char *fmt, va_list args){
6 	int n;
7 	FILE *f=sopenw();
8 	if(f==NULL)
9 		return 0;
10 	setvbuf(f, buf, _IOFBF, nbuf);
11 	n=vfprintf(f, fmt, args);
12 	sclose(f);
13 	return n;
14 }
15