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