xref: /original-bsd/lib/libplot/hp2648/open.c (revision 4092c5cc)
1 /*-
2  * Copyright (c) 1980, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)open.c	8.1 (Berkeley) 06/04/93";
10 #endif /* not lint */
11 
12 #include <sgtty.h>
13 #include "hp2648.h"
14 
15 int shakehands;
16 int currentx;
17 int currenty;
18 int buffcount;
19 int fildes;
20 float lowx;
21 float lowy;
22 float scalex;
23 float scaley;
24 struct sgttyb sarg;
25 
26 openpl()
27 {
28 	if ( isatty(fileno( stdout )) ) {
29 		shakehands = TRUE;
30 		fildes = open(TERMINAL, 0);
31 		gtty(fildes, &sarg);
32 		sarg.sg_flags = sarg.sg_flags | RAW;
33 		stty(fildes, &sarg);
34 		sarg.sg_flags = sarg.sg_flags & ~RAW;
35 	}
36 	else {
37 		shakehands = FALSE;
38 	}
39 	buffcount = 0;
40 	currentx = 0;
41 	currenty = 0;
42 	buffready(8);
43 	putchar(ESC);
44 	putchar(GRAPHIC);
45 	putchar(DISPLAY);
46 	putchar('c');
47 	putchar(ESC);
48 	putchar(GRAPHIC);
49 	putchar(PLOT);
50 	putchar(BINARY);
51 	space(0,0,720,360);
52 }
53