terminal.h revision 46283
119370Spst/* Terminal interface definitions for GDB, the GNU Debugger.
219370Spst   Copyright 1986, 1989, 1991, 1992 Free Software Foundation, Inc.
319370Spst
419370SpstThis file is part of GDB.
519370Spst
619370SpstThis program is free software; you can redistribute it and/or modify
719370Spstit under the terms of the GNU General Public License as published by
819370Spstthe Free Software Foundation; either version 2 of the License, or
919370Spst(at your option) any later version.
1019370Spst
1119370SpstThis program is distributed in the hope that it will be useful,
1219370Spstbut WITHOUT ANY WARRANTY; without even the implied warranty of
1319370SpstMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1419370SpstGNU General Public License for more details.
1519370Spst
1619370SpstYou should have received a copy of the GNU General Public License
1719370Spstalong with this program; if not, write to the Free Software
1819370SpstFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
1919370Spst
2019370Spst#if !defined (TERMINAL_H)
2119370Spst#define TERMINAL_H 1
2219370Spst
2319370Spst
2419370Spst/* If we're using autoconf, it will define HAVE_TERMIOS_H,
2519370Spst   HAVE_TERMIO_H and HAVE_SGTTY_H for us. One day we can rewrite
2619370Spst   ser-unix.c and inflow.c to inspect those names instead of
2719370Spst   HAVE_TERMIOS, HAVE_TERMIO and the implicit HAVE_SGTTY (when neither
2819370Spst   HAVE_TERMIOS or HAVE_TERMIO is set).  Until then, make sure that
2919370Spst   nothing has already defined the one of the names, and do the right
3019370Spst   thing. */
3119370Spst
3219370Spst/* nothing works with go32, and the headers aren't complete */
3319370Spst#if !defined (__GO32__)
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) */
4746283Sdfr#endif /* ! defined (__GO32__) */
4819370Spst
4919370Spst#if defined(HAVE_TERMIOS)
5019370Spst#include <termios.h>
5119370Spst#endif
5219370Spst
5346283Sdfr#if !defined(__GO32__) && !defined(_WIN32) && !defined (HAVE_TERMIOS)
5419370Spst
5519370Spst/* Define a common set of macros -- BSD based -- and redefine whatever
5619370Spst   the system offers to make it look like that.  FIXME: serial.h and
5719370Spst   ser-*.c deal with this in a much cleaner fashion; as soon as stuff
5819370Spst   is converted to use them, can get rid of this crap.  */
5919370Spst
6019370Spst#ifdef HAVE_TERMIO
6119370Spst
6219370Spst#include <termio.h>
6319370Spst
6419370Spst#undef TIOCGETP
6519370Spst#define TIOCGETP TCGETA
6619370Spst#undef TIOCSETN
6719370Spst#define TIOCSETN TCSETA
6819370Spst#undef TIOCSETP
6919370Spst#define TIOCSETP TCSETAF
7019370Spst#define TERMINAL struct termio
7119370Spst
7219370Spst#else /* sgtty */
7319370Spst
7419370Spst#include <fcntl.h>
7519370Spst#include <sgtty.h>
7619370Spst#include <sys/ioctl.h>
7719370Spst#define TERMINAL struct sgttyb
7819370Spst
7919370Spst#endif /* sgtty */
8019370Spst#endif
8119370Spst
8219370Spstextern void new_tty PARAMS ((void));
8319370Spst
8419370Spst/* Do we have job control?  Can be assumed to always be the same within
8519370Spst   a given run of GDB.  In inflow.c.  */
8619370Spstextern int job_control;
8719370Spst
8819370Spst/* Set the process group of the caller to its own pid, or do nothing if
8919370Spst   we lack job control.  */
9019370Spstextern int gdb_setpgid PARAMS ((void));
9119370Spst
9219370Spst#endif	/* !defined (TERMINAL_H) */
93