Ken Arnold edits for document distributed with 4.3BSD
[unix-history] / usr / src / lib / libcurses / printw.c
CommitLineData
87c6fcf8
DF
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
8static char sccsid[] = "@(#)printw.c 5.1 (Berkeley) %G%";
9#endif not lint
10
113386fd
KA
11/*
12 * printw and friends
13 *
113386fd
KA
14 */
15
16# include "curses.ext"
17
18/*
19 * This routine implements a printf on the standard screen.
20 */
21printw(fmt, args)
22char *fmt;
23int args; {
24
25 return _sprintw(stdscr, fmt, &args);
26}
27
28/*
29 * This routine implements a printf on the given window.
30 */
31wprintw(win, fmt, args)
32WINDOW *win;
33char *fmt;
34int 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)
48WINDOW *win;
49char *fmt;
50int *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}