1 /* 2 * Copyright (c) 1980 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 */ 6 7 #ifndef lint 8 static char sccsid[] = "@(#)printw.c 5.1 (Berkeley) 06/07/85"; 9 #endif not lint 10 11 /* 12 * printw and friends 13 * 14 */ 15 16 # include "curses.ext" 17 18 /* 19 * This routine implements a printf on the standard screen. 20 */ 21 printw(fmt, args) 22 char *fmt; 23 int args; { 24 25 return _sprintw(stdscr, fmt, &args); 26 } 27 28 /* 29 * This routine implements a printf on the given window. 30 */ 31 wprintw(win, fmt, args) 32 WINDOW *win; 33 char *fmt; 34 int args; { 35 36 return _sprintw(win, fmt, &args); 37 } 38 /* 39 * This routine actually executes the printf and adds it to the window 40 * 41 * This is really a modified version of "sprintf". As such, 42 * it assumes that sprintf interfaces with the other printf functions 43 * in a certain way. If this is not how your system works, you 44 * will have to modify this routine to use the interface that your 45 * "sprintf" uses. 46 */ 47 _sprintw(win, fmt, args) 48 WINDOW *win; 49 char *fmt; 50 int *args; { 51 52 FILE junk; 53 char buf[512]; 54 55 junk._flag = _IOWRT + _IOSTRG; 56 junk._ptr = buf; 57 junk._cnt = 32767; 58 _doprnt(fmt, args, &junk); 59 putc('\0', &junk); 60 return waddstr(win, buf); 61 } 62