overlay, not overwrite; bug report 4.3BSD/usr.lib/51, tahoe/usr.lib/2
[unix-history] / usr / src / lib / libcurses / scanw.c
CommitLineData
87c6fcf8
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7#ifndef lint
8static char sccsid[] = "@(#)scanw.c 5.1 (Berkeley) %G%";
9#endif not lint
10
4af7346f
KA
11/*
12 * scanw and friends
13 *
4af7346f
KA
14 */
15
16# include "curses.ext"
17
18/*
19 * This routine implements a scanf on the standard screen.
20 */
21scanw(fmt, args)
22char *fmt;
23int args; {
24
25 return _sscans(stdscr, fmt, &args);
26}
27/*
28 * This routine implements a scanf on the given window.
29 */
30wscanw(win, fmt, args)
31WINDOW *win;
32char *fmt;
33int args; {
34
35 return _sscans(win, fmt, &args);
36}
37/*
38 * This routine actually executes the scanf from the window.
39 *
40 * This is really a modified version of "sscanf". As such,
41 * it assumes that sscanf interfaces with the other scanf functions
42 * in a certain way. If this is not how your system works, you
43 * will have to modify this routine to use the interface that your
44 * "sscanf" uses.
45 */
46_sscans(win, fmt, args)
47WINDOW *win;
48char *fmt;
49int *args; {
50
51 char buf[100];
52 FILE junk;
53
54 junk._flag = _IOREAD|_IOSTRG;
55 junk._base = junk._ptr = buf;
56 if (wgetstr(win, buf) == ERR)
57 return ERR;
58 junk._cnt = strlen(buf);
59 return _doscan(&junk, fmt, args);
60}