xref: /illumos-gate/usr/src/ucblib/libcurses/printw.c (revision b3385a702fe5f8caba5ad4c451836514efff0bfa)
1 /*
2  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
7 /*	  All Rights Reserved  	*/
8 
9 /*
10  * Copyright (c) 1980 Regents of the University of California.
11  * All rights reserved.  The Berkeley software License Agreement
12  * specifies the terms and conditions for redistribution.
13  */
14 
15 /*LINTLIBRARY*/
16 
17 #ifndef lint
18 static char
19 sccsid[] = "@(#)printw.c 1.8 88/02/08 SMI"; /* from UCB 5.1 85/06/07 */
20 #endif /* not lint */
21 
22 #include	<stdarg.h>
23 
24 /*
25  * printw and friends
26  *
27  */
28 
29 #include	"curses.ext"
30 
31 /*
32  *	This routine implements a printf on the standard screen.
33  */
34 
35 int
36 printw(char *fmt, ...)
37 {
38 	va_list ap;
39 
40 	va_start(ap, fmt);
41 	return (_sprintw(stdscr, fmt, ap));
42 }
43 
44 /*
45  *	This routine implements a printf on the given window.
46  */
47 
48 int
49 wprintw(WINDOW *win, char *fmt, ...)
50 {
51 	va_list ap;
52 
53 	va_start(ap, fmt);
54 	return (_sprintw(win, fmt, ap));
55 }
56 /*
57  *	This routine actually executes the printf and adds it to the window
58  *
59  *	This code now uses the vsprintf routine, which portably digs
60  *	into stdio.  We provide a vsprintf for older systems that don't
61  *	have one.
62  */
63 
64 int
65 _sprintw(WINDOW *win, char *fmt, va_list ap)
66 {
67 	char	buf[512];
68 
69 	(void) vsprintf(buf, fmt, ap);
70 	return (waddstr(win, buf));
71 }
72