Annotation of 43BSD/usr.lib/libplot/dumb/open.c, revision 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[] = "@(#)open.c     5.1 (Berkeley) 5/7/85";
        !             9: #endif not lint
        !            10: 
        !            11: /*
        !            12:  * This accepts plot file formats and produces the appropriate plots
        !            13:  * for dumb terminals.  It can also be used for printing terminals and
        !            14:  * lineprinter listings, although there is no way to specify number of
        !            15:  * lines and columns different from your terminal.  This would be easy
        !            16:  * to change, and is left as an exercise for the reader.
        !            17:  */
        !            18: 
        !            19: #include <signal.h>
        !            20: #include "dumb.h"
        !            21: 
        !            22: int minX, rangeX;      /* min and range of x */
        !            23: int minY, rangeY;      /* min and range of y */
        !            24: int currentx,currenty;
        !            25: int COLS,LINES;
        !            26: 
        !            27: /* A very large screen! (probably should use malloc) */
        !            28: char screenmat[MAXCOLS][MAXLINES];
        !            29: 
        !            30: openpl()
        !            31: {
        !            32:        int closepl();
        !            33:        int i, j;
        !            34:        char *term, *getenv();
        !            35:        char bp[1024];
        !            36: 
        !            37:        term = getenv("TERM");
        !            38:        tgetent(bp, term);
        !            39: 
        !            40:        COLS = tgetnum("co");
        !            41:        if (COLS > MAXCOLS)
        !            42:                COLS = MAXCOLS;
        !            43:        if (COLS < 0)
        !            44:                COLS = 48;      /* lower bound on # of cols? */
        !            45:        COLS--;                         /* prevent auto wrap */
        !            46: 
        !            47:        LINES = tgetnum("li");
        !            48:        if (LINES > MAXLINES)
        !            49:                LINES = MAXLINES;
        !            50:        if (LINES < 0)
        !            51:                LINES = 20;     /* lower bound on # of lines? */
        !            52: 
        !            53:        for(i=0; i<COLS; i++)
        !            54:                for(j=0; j<LINES; j++)
        !            55:                        screenmat[i][j] = ' ';
        !            56: 
        !            57:        signal(SIGINT, closepl);
        !            58:        currentx = currenty = 0;
        !            59: }

unix.superglobalmegacorp.com

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