/*----------------------------------------------------------------------------*/ /* Note to Vermont Views Terminal Users. This code was sent to us by a */ /* Vermont Views customer, running Vermont Views on a SCO UNIX machine. */ /* The customer had a VV application running in the first virtual session */ /* and while working in other virtual sessions, experienced bleed through */ /* of the VV application running in the first virtual session. Below is a */ /* small program to demonstrate how to avoid this problem */ /* */ /* We do not support the code posted on the BBS by customers. It is simply */ /* put here to share information. Because we did not write this code, we */ /* can not support it. */ /*----------------------------------------------------------------------------*/ #include #include main(argc,argv) int argc; char *argv[]; { /* set vt structure for use with Vermont Views */ static struct vt_mode vt_in = { VT_PROCESS, 0, SIGUSR1, SIGUSR2, SIGUSR1 }; /* set vt structure to return to default operation */ static struct vt_mode vt_out = { VT_AUTO, 0, 0, 0, 0 }; /* set user signals to point to custom release / custom acquire routines */ signal(SIGUSR1,cust_rel); signal(SIGUSR2,cust_acq); /* tell SCO virtual terminal driver that we will handle vt switches */ ioctl(1,VT_SETMODE,&vt_in); vv_init(); /* NOTE: - before terminating this program the vt driver should be reset - disallow aborts to make sure this is done (A kill -9 will still kill this program and leave the virtual terminal driver in a bad state) */ se_abortfp((ISVRP)NULLFP); /* .........main body........ */ vv_exit(); /* reset vt driver */ ioctl(1,VT_SETMODE,&vt_out); /* reset signals */ signal(SIGUSR1,SIG_DFL); signal(SIGUSR2,SIG_DFL); } /* custom release routine (called when the user wants to switch from a vt that is running VV to another vt) */ static void cust_rel() { /* turn off signal */ signal(SIGUSR1, SIG_IGN); /* disable screen writing */ _vid_echo = OFF; /* force vt switch */ ioctl(1,VT_RELDISP,1); /* re-establish signal */ signal(SIGUSR1,cust_rel); return; } /* custom acquire routine (called when the user wants to switch from a vt to another vt running VV) */ static void cust_acq() { /* turn off signal */ signal(SIGUSR2, SIG_IGN); /* re-enable screen writing */ _vid_echo = ON; /* force vt switch */ ioctl(1,VT_RELDISP,VT_ACKACQ); /* re-establish signal */ vs_refresh(); /* re-establish signal */ signal(SIGUSR2,cust_acq); return; }