示例#1
0
/*{{{  _quit -- really quit*/
int _quit()
   {
   register WINDOW *win;
   static int really_quit=0;

   if (really_quit++) {
   /* we're in bad shape */
      perror("PANIC!!  Error during _quit()!");
      setreuid(getuid(),getuid());
      abort();
      }

   MOUSE_OFF(screen,mousex,mousey);

   sleep(1);		/* let the key (if any) un-press before resetting
			the kbd */
   set_kbd(0);		/* fix up keyboard modes */
   kbd_reset();		/* reset the keyboard */
   reset_tty(0);	/* fix up console tty modes */
#ifdef MOVIE
   end_log(); 		/* turn off logging */
#endif

   /* fix pttys */
   if (geteuid() < 2)
      for(win=active;win != (WINDOW *) 0;win=W(next))
      {
	 if (W(pid)>1) killpg(W(pid),SIGHUP);
         chmod(W(tty),0666);
         chown(W(tty),0,0);
         }

   /* fix utmp file */

#ifdef WHO
   close(getdtablesize()-1); /* make sure there are enough fd's left */
   for(win=active;win != (WINDOW *) 0;win=W(next))
      if (W(tty))
          rm_utmp(W(tty));
#endif

   CLEAR(screen,BIT_CLR);
   do_cmd( 'q' );	/* do the quiting command */
	bit_destroy(screen);
   }
示例#2
0
/*{{{  in_mouseoff -- see if mouse in rectangle, if so turn the mouse off*/
static void
in_mouseoff(int x0, int y0, int wide, int high)
{
  if (!(x0 > mousex + 16 || y0 > mousey + 16 || x0 + wide < mousex || y0 + high < mousey))
    MOUSE_OFF(screen, mousex, mousey);
}