1*11496Sralph /* ttyinit.c 4.1 83/03/09 */ 2*11496Sralph /* 3*11496Sralph * sgtty stuff 4*11496Sralph */ 5*11496Sralph 6*11496Sralph #include <sgtty.h> 7*11496Sralph 8*11496Sralph struct sgttyb _ttyb; 9*11496Sralph struct tchars _otch, _ntch; 10*11496Sralph int _normf; 11*11496Sralph 12*11496Sralph /* 13*11496Sralph * Routines for dealing with the unix tty modes 14*11496Sralph */ 15*11496Sralph 16*11496Sralph #include "2648.h" 17*11496Sralph 18*11496Sralph ttyinit() 19*11496Sralph { 20*11496Sralph if (strcmp(getenv("TERM"), "hp2648") == 0) 21*11496Sralph _on2648 = 1; 22*11496Sralph ioctl(fileno(stdin), TIOCGETP, &_ttyb); 23*11496Sralph ioctl(fileno(stdin), TIOCGETC, &_otch); 24*11496Sralph _ntch = _otch; 25*11496Sralph _ntch.t_quitc = _ntch.t_startc = _ntch.t_stopc = -1; 26*11496Sralph _normf = _ttyb.sg_flags; 27*11496Sralph _ttyb.sg_flags |= CBREAK; 28*11496Sralph _ttyb.sg_flags &= ~(ECHO|CRMOD); 29*11496Sralph ioctl(fileno(stdin), TIOCSETN, &_ttyb); 30*11496Sralph ioctl(fileno(stdin), TIOCSETC, &_ntch); 31*11496Sralph gdefault(); 32*11496Sralph zoomn(1); 33*11496Sralph zoomon(); 34*11496Sralph kon(); 35*11496Sralph rboff(); 36*11496Sralph _cursoron = 1; /* to force it off */ 37*11496Sralph _escmode = NONE; 38*11496Sralph curoff(); 39*11496Sralph clearg(); 40*11496Sralph gon(); 41*11496Sralph aoff(); 42*11496Sralph } 43*11496Sralph 44*11496Sralph done() 45*11496Sralph { 46*11496Sralph goff(); 47*11496Sralph koff(); 48*11496Sralph aon(); 49*11496Sralph sync(); 50*11496Sralph escseq(NONE); 51*11496Sralph lowleft(); 52*11496Sralph printf("\n"); 53*11496Sralph fflush(stdout); 54*11496Sralph _ttyb.sg_flags = _normf; 55*11496Sralph ioctl(fileno(stdin), TIOCSETN, &_ttyb); 56*11496Sralph ioctl(fileno(stdin), TIOCSETC, &_otch); 57*11496Sralph } 58