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