terminal.h revision 46283
112657Skvn/* Terminal interface definitions for GDB, the GNU Debugger.
212657Skvn   Copyright 1986, 1989, 1991, 1992 Free Software Foundation, Inc.
312657Skvn
412657SkvnThis file is part of GDB.
512657Skvn
612657SkvnThis program is free software; you can redistribute it and/or modify
712657Skvnit under the terms of the GNU General Public License as published by
812657Skvnthe Free Software Foundation; either version 2 of the License, or
912657Skvn(at your option) any later version.
1012657Skvn
1112657SkvnThis program is distributed in the hope that it will be useful,
1212657Skvnbut WITHOUT ANY WARRANTY; without even the implied warranty of
1312657SkvnMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1412657SkvnGNU General Public License for more details.
1512657Skvn
1612657SkvnYou should have received a copy of the GNU General Public License
1712657Skvnalong with this program; if not, write to the Free Software
1812657SkvnFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
1912657Skvn
2012657Skvn#if !defined (TERMINAL_H)
2112657Skvn#define TERMINAL_H 1
2212657Skvn
2312657Skvn
2412657Skvn/* If we're using autoconf, it will define HAVE_TERMIOS_H,
2512657Skvn   HAVE_TERMIO_H and HAVE_SGTTY_H for us. One day we can rewrite
2612657Skvn   ser-unix.c and inflow.c to inspect those names instead of
2712657Skvn   HAVE_TERMIOS, HAVE_TERMIO and the implicit HAVE_SGTTY (when neither
2812657Skvn   HAVE_TERMIOS or HAVE_TERMIO is set).  Until then, make sure that
2912968Siveresov   nothing has already defined the one of the names, and do the right
3012657Skvn   thing. */
3112657Skvn
3212657Skvn/* nothing works with go32, and the headers aren't complete */
3312657Skvn#if !defined (__GO32__)
3412657Skvn#if !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY)
3512657Skvn#if defined(HAVE_TERMIOS_H)
3612657Skvn#define HAVE_TERMIOS
3712657Skvn#else /* ! defined (HAVE_TERMIOS_H) */
3812657Skvn#if defined(HAVE_TERMIO_H)
3912657Skvn#define HAVE_TERMIO
4012657Skvn#else /* ! defined (HAVE_TERMIO_H) */
4112657Skvn#if defined(HAVE_SGTTY_H)
4212657Skvn#define HAVE_SGTTY
4312657Skvn#endif /* ! defined (HAVE_SGTTY_H) */
4412657Skvn#endif /* ! defined (HAVE_TERMIO_H) */
4512657Skvn#endif /* ! defined (HAVE_TERMIOS_H) */
4612657Skvn#endif /* !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY) */
4712657Skvn#endif /* ! defined (__GO32__) */
4812657Skvn
4912657Skvn#if defined(HAVE_TERMIOS)
5012968Siveresov#include <termios.h>
5112657Skvn#endif
5212657Skvn
5312657Skvn#if !defined(__GO32__) && !defined(_WIN32) && !defined (HAVE_TERMIOS)
5412968Siveresov
5512968Siveresov/* Define a common set of macros -- BSD based -- and redefine whatever
5612968Siveresov   the system offers to make it look like that.  FIXME: serial.h and
5712968Siveresov   ser-*.c deal with this in a much cleaner fashion; as soon as stuff
5812968Siveresov   is converted to use them, can get rid of this crap.  */
5912657Skvn
6012657Skvn#ifdef HAVE_TERMIO
6112968Siveresov
6212968Siveresov#include <termio.h>
6312657Skvn
6412657Skvn#undef TIOCGETP
6512657Skvn#define TIOCGETP TCGETA
6612657Skvn#undef TIOCSETN
6712657Skvn#define TIOCSETN TCSETA
6812657Skvn#undef TIOCSETP
6912657Skvn#define TIOCSETP TCSETAF
7012657Skvn#define TERMINAL struct termio
7112657Skvn
7212657Skvn#else /* sgtty */
7312657Skvn
7412657Skvn#include <fcntl.h>
7512657Skvn#include <sgtty.h>
7612657Skvn#include <sys/ioctl.h>
7712657Skvn#define TERMINAL struct sgttyb
7812657Skvn
7912657Skvn#endif /* sgtty */
8012657Skvn#endif
8112657Skvn
8212657Skvnextern void new_tty PARAMS ((void));
8312657Skvn
8412657Skvn/* Do we have job control?  Can be assumed to always be the same within
8512657Skvn   a given run of GDB.  In inflow.c.  */
8612657Skvnextern int job_control;
8712968Siveresov
8812968Siveresov/* Set the process group of the caller to its own pid, or do nothing if
8912657Skvn   we lack job control.  */
9012657Skvnextern int gdb_setpgid PARAMS ((void));
9112968Siveresov
9212968Siveresov#endif	/* !defined (TERMINAL_H) */
9312657Skvn