Annotation of 43BSD/usr.lib/libcurses/scanw.c, revision 1.1.1.1

1.1       root        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
                      8: static char sccsid[] = "@(#)scanw.c    5.1 (Berkeley) 6/7/85";
                      9: #endif not lint
                     10: 
                     11: /*
                     12:  * scanw and friends
                     13:  *
                     14:  */
                     15: 
                     16: # include      "curses.ext"
                     17: 
                     18: /*
                     19:  *     This routine implements a scanf on the standard screen.
                     20:  */
                     21: scanw(fmt, args)
                     22: char   *fmt;
                     23: int    args; {
                     24: 
                     25:        return _sscans(stdscr, fmt, &args);
                     26: }
                     27: /*
                     28:  *     This routine implements a scanf on the given window.
                     29:  */
                     30: wscanw(win, fmt, args)
                     31: WINDOW *win;
                     32: char   *fmt;
                     33: int    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)
                     47: WINDOW *win;
                     48: char   *fmt;
                     49: int    *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: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.