home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * Copyright (C) 1991 by Jay Konigsberg. mail: jak@sactoh0
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appear in all copies and that both the copyright notice and
- * this permission notice appear in supporting documentation. This software
- * is provided "as is" without express or implied warranty. However, the
- * author retains all Copyright priviliges and rights to renumeration if
- * this software is sold.
- *
- * Also, and very important. This game is for recrecation ONLY and is NOT
- * to be used for gambling in any way.
- */
-
- /*
- * rawmode.c - enter character at a time processing. I ripped this off
- * from one of my other programs because the one in curses didn't work
- * the way _I_ wanted :-)
- */
-
- #include <stdio.h>
- #include <termio.h>
- #include <signal.h>
- #include "vid_extern.h"
- #include "vid_local.h"
-
- extern int errno;
-
- /* Global for interrupt routine: cleanup() */
- struct termio ttyset; /* terminal settings */
- unsigned short c_lflag_hold; /* hold original values for reset */
- unsigned char VEOF_hold; /* hold original value for reset */
-
- /*
- *enter raw mode
- */
- void rawmode()
- {
- if ( ioctl(0, TCGETA, &ttyset) == -1 )
- {
- fprintf(stderr, "ioctl: error=%d\n", errno);
- (void)exit(2);
- }
- c_lflag_hold=ttyset.c_lflag;
- VEOF_hold = ttyset.c_cc[4];
-
- ttyset.c_cc[4] = (unsigned char)1;
- ttyset.c_lflag &= ~(ICANON | ECHO);
-
- if ( ioctl(0, TCSETAW, &ttyset) == -1 )
- {
- fprintf(stderr, "ioctl: error=%d\n",errno);
- }
- signal(SIGINT, cleanup);
- }
-