GRASS Programmer's Manual  6.4.2(2012)
intr_char.c
Go to the documentation of this file.
00001 #include <grass/gis.h>
00002 
00003 #include <grass/config.h>
00004 #ifndef __MINGW32__
00005 #if defined(HAVE_TERMIOS_H)
00006 # include <termios.h>
00007 # define TYPE termios
00008 # define C c_cc[VINTR]
00009 #elif defined(HAVE_TERMIO_H)
00010 # include <termio.h>
00011 # define TYPE termio
00012 # define C c_cc[VINTR]
00013 # define GET TCGETA
00014 #else
00015 # include <sgtty.h>
00016 # define TYPE tchars
00017 # define C t_intrc
00018 # define GET TIOCGETC
00019 #endif
00020 #endif
00021 
00033 char G_intr_char(void)
00034 {
00035     char c = 0;
00036 
00037 #ifndef __MINGW32__
00038     struct TYPE buf;
00039 
00040 #ifdef HAVE_TERMIOS_H
00041     tcgetattr(2, &buf);
00042 #else
00043     ioctl(2, GET, &buf);
00044 #endif
00045     c = buf.C;
00046 #endif
00047     return c;
00048 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines