148517Sbostic /*- 2*61393Sbostic * Copyright (c) 1980, 1993 3*61393Sbostic * The Regents of the University of California. All rights reserved. 448517Sbostic * 548517Sbostic * %sccs.include.proprietary.c% 619975Sdist */ 719975Sdist 815459Sralph #ifndef lint 9*61393Sbostic static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 06/04/93"; 1048517Sbostic #endif /* not lint */ 1115459Sralph 1215459Sralph #include <sgtty.h> 1315459Sralph #include "hp2648.h" 1415459Sralph handshake()1515459Sralphhandshake() 1615459Sralph { 1715459Sralph int i; 1815459Sralph char ch; 1915459Sralph 2015459Sralph if( shakehands != TRUE ) 2115459Sralph return; 2215459Sralph ch = ' '; 2315459Sralph putchar(ENQ); 2415459Sralph fflush(stdout); 2515459Sralph while(1){ 2615459Sralph i = read(fildes, &ch, 1); 2715459Sralph if(i < 0) 2815459Sralph continue; 2915459Sralph if(ch == ACK) 3015459Sralph break; 3115459Sralph putchar('Z'); 3215459Sralph fflush(stdout); 3315459Sralph stty(fildes, &sarg); 3415459Sralph exit(0); 3515459Sralph } 3615459Sralph } 3715459Sralph buffready(n)3815459Sralphbuffready(n) 3915459Sralph int n; 4015459Sralph { 4115459Sralph buffcount = buffcount + n; 4215459Sralph if(buffcount >= 80){ 4315459Sralph handshake(); 4415459Sralph putchar(ESC); 4515459Sralph putchar(GRAPHIC); 4615459Sralph putchar(PLOT); 4715459Sralph putchar(BINARY); 4815459Sralph buffcount = n+4; 4915459Sralph } 5015459Sralph } 5115459Sralph itoa(num,byte1,byte2)5215459Sralphitoa(num,byte1,byte2) 5315459Sralph int num; 5415459Sralph char *byte1,*byte2; 5515459Sralph { 5615459Sralph *byte1 = (num & 037) | 040; 5715459Sralph *byte2 = ((num>>5) & 037) | 040; 5815459Sralph } 59