xref: /original-bsd/lib/libplot/hp2648/open.c (revision 50dd0bba)
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) 05/07/85";
9 #endif not lint
10 
11 #include <sgtty.h>
12 #include "hp2648.h"
13 
14 int shakehands;
15 int currentx;
16 int currenty;
17 int buffcount;
18 int fildes;
19 float lowx;
20 float lowy;
21 float scalex;
22 float scaley;
23 struct sgttyb sarg;
24 
25 openpl()
26 {
27 	if ( isatty(fileno( stdout )) ) {
28 		shakehands = TRUE;
29 		fildes = open(TERMINAL, 0);
30 		gtty(fildes, &sarg);
31 		sarg.sg_flags = sarg.sg_flags | RAW;
32 		stty(fildes, &sarg);
33 		sarg.sg_flags = sarg.sg_flags & ~RAW;
34 	}
35 	else {
36 		shakehands = FALSE;
37 	}
38 	buffcount = 0;
39 	currentx = 0;
40 	currenty = 0;
41 	buffready(8);
42 	putchar(ESC);
43 	putchar(GRAPHIC);
44 	putchar(DISPLAY);
45 	putchar('c');
46 	putchar(ESC);
47 	putchar(GRAPHIC);
48 	putchar(PLOT);
49 	putchar(BINARY);
50 	space(0,0,720,360);
51 }
52