xref: /original-bsd/usr.bin/window/wwprintf.c (revision a757cc93)
1 #ifndef lint
2 static	char *sccsid = "@(#)wwprintf.c	1.4 83/07/22";
3 #endif
4 
5 #include "ww.h"
6 
7 wwprintf(w, fmt, args)
8 struct ww *w;
9 char *fmt;
10 {
11 	struct _iobuf _wwbuf;
12 	static char buf[1024];
13 
14 	/*
15 	 * A danger is that when buf overflows, _flsbuf() will be
16 	 * called automatically.  It doesn't check for _IOSTR.
17 	 * We set the file descriptor to -1 so no actual io will be done.
18 	 */
19 	_wwbuf._flag = _IOWRT+_IOSTRG;
20 	_wwbuf._base = _wwbuf._ptr = buf;
21 	_wwbuf._cnt = sizeof buf;
22 	_wwbuf._file = -1;			/* safe */
23 	_doprnt(fmt, &args, &_wwbuf);
24 	return wwwrite(w, buf, _wwbuf._ptr - buf);
25 }
26 
27 /*
28 wwprintf(w, fmt, args)
29 struct ww *w;
30 char *fmt;
31 {
32 	_doprnt(fmt, &args, w);
33 	return 0;
34 }
35 
36 _strout(count, string, adjust, file, fillch)
37 register char *string;
38 register count;
39 int adjust;
40 register struct ww *file;
41 {
42 	while (adjust < 0) {
43 		if (*string=='-' && fillch=='0') {
44 			wputc(*string++, file);
45 			count--;
46 		}
47 		wputc(fillch, file);
48 		adjust++;
49 	}
50 	while (--count>=0)
51 		wputc(*string++, file);
52 	while (adjust) {
53 		wputc(fillch, file);
54 		adjust--;
55 	}
56 }
57 */
58