1: /* 2: * printw and friends 3: * 4: * 1/26/81 (Berkeley) @(#)printw.c 1.1 5: */ 6: 7: # include "curses.ext" 8: 9: /* 10: * This routine implements a printf on the standard screen. 11: */ 12: printw(fmt, args) 13: char *fmt; 14: int args; { 15: 16: return _sprintw(stdscr, fmt, &args); 17: } 18: 19: /* 20: * This routine implements a printf on the given window. 21: */ 22: wprintw(win, fmt, args) 23: WINDOW *win; 24: char *fmt; 25: int args; { 26: 27: return _sprintw(win, fmt, &args); 28: } 29: /* 30: * This routine actually executes the printf and adds it to the window 31: * 32: * This is really a modified version of "sprintf". As such, 33: * it assumes that sprintf interfaces with the other printf functions 34: * in a certain way. If this is not how your system works, you 35: * will have to modify this routine to use the interface that your 36: * "sprintf" uses. 37: */ 38: _sprintw(win, fmt, args) 39: WINDOW *win; 40: char *fmt; 41: int *args; { 42: 43: FILE junk; 44: char buf[512]; 45: 46: junk._flag = _IOWRT + _IOSTRG; 47: junk._ptr = buf; 48: junk._cnt = 32767; 49: _doprnt(fmt, args, &junk); 50: putc('\0', &junk); 51: return waddstr(win, buf); 52: }