119370Spst/* Terminal interface definitions for GDB, the GNU Debugger. 298944Sobrien Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1995, 1996, 1999, 2000 398944Sobrien Free Software Foundation, Inc. 419370Spst 598944Sobrien This file is part of GDB. 619370Spst 798944Sobrien This program is free software; you can redistribute it and/or modify 898944Sobrien it under the terms of the GNU General Public License as published by 998944Sobrien the Free Software Foundation; either version 2 of the License, or 1098944Sobrien (at your option) any later version. 1119370Spst 1298944Sobrien This program is distributed in the hope that it will be useful, 1398944Sobrien but WITHOUT ANY WARRANTY; without even the implied warranty of 1498944Sobrien MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1598944Sobrien GNU General Public License for more details. 1619370Spst 1798944Sobrien You should have received a copy of the GNU General Public License 1898944Sobrien along with this program; if not, write to the Free Software 1998944Sobrien Foundation, Inc., 59 Temple Place - Suite 330, 2098944Sobrien Boston, MA 02111-1307, USA. */ 2119370Spst 2219370Spst#if !defined (TERMINAL_H) 2319370Spst#define TERMINAL_H 1 2419370Spst 2519370Spst 2619370Spst/* If we're using autoconf, it will define HAVE_TERMIOS_H, 2719370Spst HAVE_TERMIO_H and HAVE_SGTTY_H for us. One day we can rewrite 2819370Spst ser-unix.c and inflow.c to inspect those names instead of 2919370Spst HAVE_TERMIOS, HAVE_TERMIO and the implicit HAVE_SGTTY (when neither 3019370Spst HAVE_TERMIOS or HAVE_TERMIO is set). Until then, make sure that 3119370Spst nothing has already defined the one of the names, and do the right 3219370Spst thing. */ 3319370Spst 3419370Spst#if !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY) 3519370Spst#if defined(HAVE_TERMIOS_H) 3619370Spst#define HAVE_TERMIOS 3746283Sdfr#else /* ! defined (HAVE_TERMIOS_H) */ 3846283Sdfr#if defined(HAVE_TERMIO_H) 3919370Spst#define HAVE_TERMIO 4046283Sdfr#else /* ! defined (HAVE_TERMIO_H) */ 4146283Sdfr#if defined(HAVE_SGTTY_H) 4219370Spst#define HAVE_SGTTY 4346283Sdfr#endif /* ! defined (HAVE_SGTTY_H) */ 4446283Sdfr#endif /* ! defined (HAVE_TERMIO_H) */ 4546283Sdfr#endif /* ! defined (HAVE_TERMIOS_H) */ 4646283Sdfr#endif /* !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY) */ 4719370Spst 4819370Spst#if defined(HAVE_TERMIOS) 4919370Spst#include <termios.h> 5019370Spst#endif 5119370Spst 5298944Sobrien#if !defined(_WIN32) && !defined (HAVE_TERMIOS) 5319370Spst 5419370Spst/* Define a common set of macros -- BSD based -- and redefine whatever 5519370Spst the system offers to make it look like that. FIXME: serial.h and 5619370Spst ser-*.c deal with this in a much cleaner fashion; as soon as stuff 5719370Spst is converted to use them, can get rid of this crap. */ 5819370Spst 5919370Spst#ifdef HAVE_TERMIO 6019370Spst 6119370Spst#include <termio.h> 6219370Spst 6319370Spst#undef TIOCGETP 6419370Spst#define TIOCGETP TCGETA 6519370Spst#undef TIOCSETN 6619370Spst#define TIOCSETN TCSETA 6719370Spst#undef TIOCSETP 6819370Spst#define TIOCSETP TCSETAF 6919370Spst#define TERMINAL struct termio 7019370Spst 7119370Spst#else /* sgtty */ 7219370Spst 7319370Spst#include <fcntl.h> 7419370Spst#include <sgtty.h> 7519370Spst#include <sys/ioctl.h> 7619370Spst#define TERMINAL struct sgttyb 7719370Spst 7819370Spst#endif /* sgtty */ 7919370Spst#endif 8019370Spst 8198944Sobrienextern void new_tty (void); 8219370Spst 8319370Spst/* Do we have job control? Can be assumed to always be the same within 8419370Spst a given run of GDB. In inflow.c. */ 8519370Spstextern int job_control; 8619370Spst 8719370Spst/* Set the process group of the caller to its own pid, or do nothing if 8819370Spst we lack job control. */ 8998944Sobrienextern int gdb_setpgid (void); 9019370Spst 9198944Sobrien#endif /* !defined (TERMINAL_H) */ 92