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