xref: /original-bsd/lib/libcurses/mvprintw.c (revision 9842e909)
1 /*
2  * Copyright (c) 1981 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)mvprintw.c	5.8 (Berkeley) 06/19/91";
10 #endif /* not lint */
11 
12 #if __STDC__
13 #include <stdarg.h>
14 #else
15 #include <varargs.h>
16 #endif
17 #include "curses.ext"
18 
19 /*
20  * implement the mvprintw commands.  Due to the variable number of
21  * arguments, they cannot be macros.  Sigh....
22  */
23 
24 #if __STDC__
25 mvprintw(reg int y, reg int x, const char *fmt, ...)
26 #else
27 mvprintw(y, x, fmt, va_alist)
28 	reg int y, x;
29 	char *fmt;
30 	va_dcl
31 #endif
32 {
33 	va_list ap;
34 	int ret;
35 
36 	if (move(y, x) != OK)
37 		return ERR;
38 #if __STDC__
39 	va_start(ap, fmt);
40 #else
41 	va_start(ap);
42 #endif
43 	ret = _sprintw(stdscr, fmt, ap);
44 	va_end(ap);
45 	return ret;
46 }
47 
48 #if __STDC__
49 mvwprintw(reg WINDOW *win, reg int y, reg int x, const char *fmt, ...)
50 #else
51 mvwprintw(win, y, x, fmt, va_alist)
52 	reg WINDOW *win;
53 	reg int y, x;
54 	char *fmt;
55 	va_dcl
56 #endif
57 {
58 	va_list ap;
59 	int ret;
60 
61 	if (wmove(win, y, x) != OK)
62 		return ERR;
63 #if __STDC__
64 	va_start(ap, fmt);
65 #else
66 	va_start(ap);
67 #endif
68 	ret = _sprintw(win, fmt, ap);
69 	va_end(ap);
70 	return ret;
71 }
72