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