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