1 #ifndef lint 2 static char sccsid[] = "@(#)wwprintf.c 3.6 10/02/87"; 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 #include <varargs.h> 13 14 /*VARARGS2*/ 15 wwprintf(w, fmt, va_alist) 16 struct ww *w; 17 char *fmt; 18 va_dcl 19 { 20 #include <stdio.h> 21 struct _iobuf _wwbuf; 22 char buf[1024]; 23 va_list ap; 24 25 /* 26 * A danger is that when buf overflows, _flsbuf() will be 27 * called automatically. It doesn't check for _IOSTR. 28 * We set the file descriptor to -1 so no actual io will be done. 29 */ 30 _wwbuf._flag = _IOWRT+_IOSTRG; 31 _wwbuf._base = _wwbuf._ptr = buf; 32 _wwbuf._cnt = sizeof buf; 33 _wwbuf._file = -1; /* safe */ 34 va_start(ap); 35 _doprnt(fmt, ap, &_wwbuf); 36 va_end(ap); 37 (void) wwwrite(w, buf, _wwbuf._ptr - buf); 38 } 39