xref: /titanic_51/usr/src/ucblib/libcurses/printw.c (revision bbaa8b60dd95d714741fc474adad3cf710ef4efd)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
16 
17 /*LINTLIBRARY*/
18 
19 #ifndef lint
20 static char
21 sccsid[] = "@(#)printw.c 1.8 88/02/08 SMI"; /* from UCB 5.1 85/06/07 */
22 #endif /* not lint */
23 
24 #include	<stdarg.h>
25 
26 /*
27  * printw and friends
28  *
29  */
30 
31 #include	"curses.ext"
32 
33 /*
34  *	This routine implements a printf on the standard screen.
35  */
36 
37 int
38 printw(char *fmt, ...)
39 {
40 	va_list ap;
41 
42 	va_start(ap, fmt);
43 	return (_sprintw(stdscr, fmt, ap));
44 }
45 
46 /*
47  *	This routine implements a printf on the given window.
48  */
49 
50 int
51 wprintw(WINDOW *win, char *fmt, ...)
52 {
53 	va_list ap;
54 
55 	va_start(ap, fmt);
56 	return (_sprintw(win, fmt, ap));
57 }
58 /*
59  *	This routine actually executes the printf and adds it to the window
60  *
61  *	This code now uses the vsprintf routine, which portably digs
62  *	into stdio.  We provide a vsprintf for older systems that don't
63  *	have one.
64  */
65 
66 int
67 _sprintw(WINDOW *win, char *fmt, va_list ap)
68 {
69 	char	buf[512];
70 
71 	(void) vsprintf(buf, fmt, ap);
72 	return (waddstr(win, buf));
73 }
74