xref: /original-bsd/usr.bin/window/wwprintf.c (revision 45c3762f)
1 #ifndef lint
2 static char sccsid[] = "@(#)wwprintf.c	3.5 04/24/85";
3 #endif
4 
5 /*
6  * Copyright (c) 1983 Regents of the University of California,
7  * All rights reserved.  Redistribution permitted subject to
8  * the terms of the Berkeley Software License Agreement.
9  */
10 
11 #include "ww.h"
12 
13 /*VARARGS2*/
14 wwprintf(w, fmt, args)
15 struct ww *w;
16 char *fmt;
17 {
18 #include <stdio.h>
19 	struct _iobuf _wwbuf;
20 	char buf[1024];
21 
22 	/*
23 	 * A danger is that when buf overflows, _flsbuf() will be
24 	 * called automatically.  It doesn't check for _IOSTR.
25 	 * We set the file descriptor to -1 so no actual io will be done.
26 	 */
27 	_wwbuf._flag = _IOWRT+_IOSTRG;
28 	_wwbuf._base = _wwbuf._ptr = buf;
29 	_wwbuf._cnt = sizeof buf;
30 	_wwbuf._file = -1;			/* safe */
31 	_doprnt(fmt, &args, &_wwbuf);
32 	(void) wwwrite(w, buf, _wwbuf._ptr - buf);
33 }
34