home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3281 / cleanup.c next >
Encoding:
C/C++ Source or Header  |  1991-05-03  |  1.4 KB  |  46 lines

  1.  
  2. /*
  3.  * Copyright (C) 1991 by Jay Konigsberg. mail: jak@sactoh0
  4.  *
  5.  * Permission to use, copy, modify, and distribute this  software  and  its
  6.  * documentation is hereby  granted,  provided  that  the  above  copyright
  7.  * notice appear in all copies  and that  both  the  copyright  notice  and
  8.  * this permission notice appear in supporting documentation. This software
  9.  * is provided "as is" without express or implied  warranty.  However,  the
  10.  * author retains all Copyright priviliges and rights  to  renumeration  if
  11.  * this software is sold.
  12.  *
  13.  * Also, and very important. This game is for recrecation ONLY and is NOT
  14.  * to be used for gambling in any way. 
  15.  */
  16.  
  17. /*
  18.  * cleanup - resets port settings to what they were before entering
  19.  * raw mode.
  20.  */
  21.  
  22. #include    <stdio.h>
  23. #include    <termio.h>
  24. #include    "vid_extern.h"
  25.  
  26. extern    int    errno;
  27.  
  28. /* Global for interrupt routine: cleanup() */
  29. extern    struct      termio  ttyset;    /* terminal settings */
  30. extern    unsigned  short   c_lflag_hold;    /* hold original values for reset */
  31. extern    unsigned  char    VEOF_hold;    /* hold original value for reset */
  32.  
  33. int    (*cleanup())    /* Signal trap for SIGINT */
  34. {
  35. /* reset terminal charastics */
  36. ttyset.c_lflag = c_lflag_hold;
  37. ttyset.c_cc[4] = VEOF_hold;
  38. if ( ioctl(0, TCSETAW, &ttyset) == -1) {
  39.     fprintf(stderr, "ioctl: error=%d\n", errno);
  40.     (void)exit(2);
  41. }
  42. puts("\nExiting Video Poker\t\t\t\t\t\t");
  43. (void)exit(0);
  44. return(0);
  45. }
  46.