Commit | Line | Data |
---|---|---|
15eea6e6 BJ |
1 | # include "curses.ext" |
2 | ||
3 | /* | |
4 | * This routine implements a scanf on the standard screen. | |
5 | */ | |
6 | scanw(fmt, args) | |
7 | char *fmt; | |
8 | int args; { | |
9 | ||
10 | return _sscans(stdscr, fmt, &args); | |
11 | } | |
12 | /* | |
13 | * This routine implements a scanf on the given window. | |
14 | */ | |
15 | wscanw(win, fmt, args) | |
16 | WINDOW *win; | |
17 | char *fmt; | |
18 | int args; { | |
19 | ||
20 | return _sscans(win, fmt, &args); | |
21 | } | |
22 | /* | |
23 | * This routine actually executes the scanf from the window. | |
24 | */ | |
25 | _sscans(win, fmt, args) | |
26 | WINDOW *win; | |
27 | char *fmt; | |
28 | int *args; { | |
29 | ||
30 | char buf[100]; | |
31 | FILE junk; | |
32 | ||
33 | junk._flag = _IOREAD|_IOSTRG; | |
34 | junk._base = junk._ptr = buf; | |
35 | if (wgetstr(win, buf) == ERR) | |
36 | return ERR; | |
37 | junk._cnt = strlen(buf); | |
38 | return _doscan(&junk, fmt, args); | |
39 | } |