1 /* Terminal interface definitions for GDB, the GNU Debugger. 2 Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1995, 1996, 1999, 2000 3 Free Software Foundation, Inc. 4 5 This file is part of GDB. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place - Suite 330, 20 Boston, MA 02111-1307, USA. */ 21 22 #if !defined (TERMINAL_H) 23 #define TERMINAL_H 1 24 25 26 /* If we're using autoconf, it will define HAVE_TERMIOS_H, 27 HAVE_TERMIO_H and HAVE_SGTTY_H for us. One day we can rewrite 28 ser-unix.c and inflow.c to inspect those names instead of 29 HAVE_TERMIOS, HAVE_TERMIO and the implicit HAVE_SGTTY (when neither 30 HAVE_TERMIOS or HAVE_TERMIO is set). Until then, make sure that 31 nothing has already defined the one of the names, and do the right 32 thing. */ 33 34 #if !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY) 35 #if defined(HAVE_TERMIOS_H) 36 #define HAVE_TERMIOS 37 #else /* ! defined (HAVE_TERMIOS_H) */ 38 #if defined(HAVE_TERMIO_H) 39 #define HAVE_TERMIO 40 #else /* ! defined (HAVE_TERMIO_H) */ 41 #if defined(HAVE_SGTTY_H) 42 #define HAVE_SGTTY 43 #endif /* ! defined (HAVE_SGTTY_H) */ 44 #endif /* ! defined (HAVE_TERMIO_H) */ 45 #endif /* ! defined (HAVE_TERMIOS_H) */ 46 #endif /* !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY) */ 47 48 #if defined(HAVE_TERMIOS) 49 #include <termios.h> 50 #endif 51 52 #if !defined(_WIN32) && !defined (HAVE_TERMIOS) 53 54 /* Define a common set of macros -- BSD based -- and redefine whatever 55 the system offers to make it look like that. FIXME: serial.h and 56 ser-*.c deal with this in a much cleaner fashion; as soon as stuff 57 is converted to use them, can get rid of this crap. */ 58 59 #ifdef HAVE_TERMIO 60 61 #include <termio.h> 62 63 #undef TIOCGETP 64 #define TIOCGETP TCGETA 65 #undef TIOCSETN 66 #define TIOCSETN TCSETA 67 #undef TIOCSETP 68 #define TIOCSETP TCSETAF 69 #define TERMINAL struct termio 70 71 #else /* sgtty */ 72 73 #include <fcntl.h> 74 #include <sgtty.h> 75 #include <sys/ioctl.h> 76 #define TERMINAL struct sgttyb 77 78 #endif /* sgtty */ 79 #endif 80 81 extern void new_tty (void); 82 83 /* Do we have job control? Can be assumed to always be the same within 84 a given run of GDB. In inflow.c. */ 85 extern int job_control; 86 87 /* Set the process group of the caller to its own pid, or do nothing if 88 we lack job control. */ 89 extern int gdb_setpgid (void); 90 91 #endif /* !defined (TERMINAL_H) */ 92