xref: /illumos-gate/usr/src/lib/libxcurses/src/libc/xcurses/scanw.c (revision f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1995, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  * scanw.c
31  *
32  * XCurses Library
33  *
34  * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
35  *
36  */
37 
38 #ifdef M_RCSID
39 #ifndef lint
40 static char rcsID[] = "$Header: /rd/src/libc/xcurses/rcs/scanw.c 1.2 1995/07/14 20:50:28 ant Exp $";
41 #endif
42 #endif
43 
44 #include <private.h>
45 #include <limits.h>
46 #include <stdarg.h>
47 
48 int
49 scanw(const char *fmt, ...)
50 {
51 	int code;
52 	va_list ap;
53 
54 #ifdef M_CURSES_TRACE
55 	__m_trace("scanw(%p = \"%s\", ...)", fmt, fmt);
56 #endif
57 
58 	va_start(ap, fmt);
59 	code = vw_scanw(stdscr, fmt, ap);
60 	va_end(ap);
61 
62 	return __m_return_code("scanw", code);
63 }
64 
65 int
66 mvscanw(int y, int x, const char *fmt, ...)
67 {
68 	int code;
69 	va_list ap;
70 
71 #ifdef M_CURSES_TRACE
72 	__m_trace("mvscanw(%d, %d, %p = \"%s\", ...)", y, x, fmt, fmt);
73 #endif
74 
75 	va_start(ap, fmt);
76 	if ((code = wmove(stdscr, y, x)) == OK)
77 		code = vw_scanw(stdscr, fmt, ap);
78 	va_end(ap);
79 
80 	return __m_return_code("mvscanw", code);
81 }
82 
83 int
84 mvwscanw(WINDOW *w, int y, int x, const char *fmt, ...)
85 {
86 	int code;
87 	va_list ap;
88 
89 #ifdef M_CURSES_TRACE
90 	__m_trace("mvwscanw(%p, %d, %d, %p = \"%s\", ...)", w, y, x, fmt, fmt);
91 #endif
92 
93 	va_start(ap, fmt);
94 	if ((code = wmove(w, y, x)) == OK)
95 		code = vw_scanw(w, fmt, ap);
96 	va_end(ap);
97 
98 	return __m_return_code("mvwscanw", code);
99 }
100 
101 int
102 wscanw(WINDOW *w, const char *fmt, ...)
103 {
104 	int code;
105 	va_list ap;
106 
107 #ifdef M_CURSES_TRACE
108 	__m_trace("wscanw(%p, %p = \"%s\", ...)", w, fmt, fmt);
109 #endif
110 
111 	va_start(ap, fmt);
112 	code = vw_scanw(w, fmt, ap);
113 	va_end(ap);
114 
115 	return __m_return_code("wscanw", code);
116 }
117 
118