xref: /original-bsd/usr.bin/window/wwprintf.c (revision 4b2c5e10)
1 #ifndef lint
2 static	char *sccsid = "@(#)wwprintf.c	3.1 83/08/11";
3 #endif
4 
5 #include "ww.h"
6 
7 /*VARARGS2*/
8 wwprintf(w, fmt, args)
9 struct ww *w;
10 char *fmt;
11 {
12 	struct _iobuf _wwbuf;
13 	static char buf[1024];
14 
15 	/*
16 	 * A danger is that when buf overflows, _flsbuf() will be
17 	 * called automatically.  It doesn't check for _IOSTR.
18 	 * We set the file descriptor to -1 so no actual io will be done.
19 	 */
20 	_wwbuf._flag = _IOWRT+_IOSTRG;
21 	_wwbuf._base = _wwbuf._ptr = buf;
22 	_wwbuf._cnt = sizeof buf;
23 	_wwbuf._file = -1;			/* safe */
24 	_doprnt(fmt, &args, &_wwbuf);
25 	return wwwrite(w, buf, _wwbuf._ptr - buf);
26 }
27