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