|
|
1.1 root 1: /*********************************************************************
2: * COPYRIGHT NOTICE *
3: **********************************************************************
4: * This software is copyright (C) 1982 by Pavel Curtis *
5: * *
6: * Permission is granted to reproduce and distribute *
7: * this file by any means so long as no fee is charged *
8: * above a nominal handling fee and so long as this *
9: * notice is always included in the copies. *
10: * *
11: * Other rights are reserved except as explicitly granted *
12: * by written permission of the author. *
13: * Pavel Curtis *
14: * Computer Science Dept. *
15: * 405 Upson Hall *
16: * Cornell University *
17: * Ithaca, NY 14853 *
18: * *
19: * Ph- (607) 256-4934 *
20: * *
21: * Pavel.Cornell@Udel-Relay (ARPAnet) *
22: * decvax!cornell!pavel (UUCPnet) *
23: *********************************************************************/
24:
25: /*
26: ** lib_scanw.c
27: **
28: ** The routines scanw(), wscanw() and friend.
29: **
30: ** $Log: lib_scanw.c,v $
31: * Revision 1.8 93/04/12 14:14:02 bin
32: * Udo: third color update
33: *
34: * Revision 1.2 92/04/13 14:38:23 bin
35: * update by vlad
36: *
37: * Revision 2.2 91/01/27 15:17:12 munk
38: * Rewritten for COHERENT and portable usage of variable arguments
39: *
40: * Revision 2.1 82/10/25 14:48:51 pavel
41: * Added Copyright Notice
42: *
43: * Revision 2.0 82/10/25 13:49:07 pavel
44: * Beta-one Test Release
45: *
46: **
47: */
48:
49: #ifdef RCSHDR
50: static char RCSid[] =
51: "$Header: /src386/usr/lib/ncurses/RCS/lib_scanw.c,v 1.8 93/04/12 14:14:02 bin Exp Locker: bin $";
52: #endif
53:
54: #include "curses.h"
55: #include "curses.priv.h"
56:
57: #define VARARGS v1, v2, v3, v4, v5, v6, v7, v8, v9, v10
58:
59:
60: scanw(fmt, VARARGS)
61: char *fmt;
62: int VARARGS;
63: {
64: #ifdef TRACE
65: if (_tracing)
66: _tracef("scanw(%s,...) called", fmt);
67: #endif
68:
69: return(sscans(stdscr, fmt, VARARGS));
70: }
71:
72:
73: wscanw(win, fmt, VARARGS)
74: WINDOW *win;
75: char *fmt;
76: int VARARGS;
77: {
78: #ifdef TRACE
79: if (_tracing)
80: _tracef("wscanw(%o,%s,...) called", win, fmt);
81: #endif
82:
83: return(sscans(win, fmt, VARARGS));
84: }
85:
86:
87: mvscanw(y, x, fmt, VARARGS)
88: int y, x;
89: char *fmt;
90: int VARARGS;
91: {
92: return(move(y, x) == OK ? sscans(stdscr, fmt, VARARGS) : ERR);
93: }
94:
95:
96: mvwscanw(win, y, x, fmt, VARARGS)
97: WINDOW *win;
98: int y, x;
99: char *fmt;
100: int VARARGS;
101: {
102: return(wmove(win, y, x) == OK ? sscans(win, fmt, VARARGS) : ERR);
103: }
104:
105:
106: /*
107: ** This routine actually executes the scanf from the window.
108: */
109:
110: static
111: sscans(win, fmt, VARARGS)
112: WINDOW *win;
113: char *fmt;
114: int *VARARGS;
115: {
116: static char buf[100];
117:
118: if (wgetstr(win, buf) == ERR)
119: return(ERR);
120: return(sscanf(buf, fmt, VARARGS));
121: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.