]>
Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Terminal interface definitions for GDB, the GNU Debugger. |
0b302171 JB |
2 | Copyright (C) 1986, 1989-1993, 1995-1996, 1999-2000, 2006-2012 Free |
3 | Software Foundation, Inc. | |
c906108c | 4 | |
c5aa993b | 5 | This file is part of GDB. |
c906108c | 6 | |
c5aa993b JM |
7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
c5aa993b | 10 | (at your option) any later version. |
c906108c | 11 | |
c5aa993b JM |
12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
c906108c | 16 | |
c5aa993b | 17 | You should have received a copy of the GNU General Public License |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c906108c SS |
19 | |
20 | #if !defined (TERMINAL_H) | |
21 | #define TERMINAL_H 1 | |
22 | ||
23 | ||
24 | /* If we're using autoconf, it will define HAVE_TERMIOS_H, | |
c378eb4e | 25 | HAVE_TERMIO_H and HAVE_SGTTY_H for us. One day we can rewrite |
c906108c SS |
26 | ser-unix.c and inflow.c to inspect those names instead of |
27 | HAVE_TERMIOS, HAVE_TERMIO and the implicit HAVE_SGTTY (when neither | |
28 | HAVE_TERMIOS or HAVE_TERMIO is set). Until then, make sure that | |
29 | nothing has already defined the one of the names, and do the right | |
c378eb4e | 30 | thing. */ |
c906108c | 31 | |
c906108c SS |
32 | #if !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY) |
33 | #if defined(HAVE_TERMIOS_H) | |
34 | #define HAVE_TERMIOS | |
35 | #else /* ! defined (HAVE_TERMIOS_H) */ | |
36 | #if defined(HAVE_TERMIO_H) | |
37 | #define HAVE_TERMIO | |
38 | #else /* ! defined (HAVE_TERMIO_H) */ | |
39 | #if defined(HAVE_SGTTY_H) | |
40 | #define HAVE_SGTTY | |
41 | #endif /* ! defined (HAVE_SGTTY_H) */ | |
42 | #endif /* ! defined (HAVE_TERMIO_H) */ | |
43 | #endif /* ! defined (HAVE_TERMIOS_H) */ | |
3e43a32a MS |
44 | #endif /* !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) && |
45 | !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 | ||
191c4426 PA |
80 | struct inferior; |
81 | ||
82 | extern void new_tty_prefork (const char *); | |
83 | ||
a14ed312 | 84 | extern void new_tty (void); |
c906108c | 85 | |
191c4426 PA |
86 | extern void new_tty_postfork (void); |
87 | ||
88 | extern void copy_terminal_info (struct inferior *to, struct inferior *from); | |
89 | ||
c906108c SS |
90 | /* Do we have job control? Can be assumed to always be the same within |
91 | a given run of GDB. In inflow.c. */ | |
92 | extern int job_control; | |
93 | ||
a0fe373c | 94 | extern pid_t create_tty_session (void); |
83116857 | 95 | |
c906108c SS |
96 | /* Set the process group of the caller to its own pid, or do nothing if |
97 | we lack job control. */ | |
a14ed312 | 98 | extern int gdb_setpgid (void); |
c906108c | 99 | |
0ea3f30e DJ |
100 | /* Set up a serial structure describing standard input. In inflow.c. */ |
101 | extern void initialize_stdin_serial (void); | |
102 | ||
191c4426 PA |
103 | extern int gdb_has_a_terminal (void); |
104 | ||
105 | /* Set the process group of the caller to its own pid, or do nothing | |
106 | if we lack job control. */ | |
107 | extern int gdb_setpgid (void); | |
108 | ||
c5aa993b | 109 | #endif /* !defined (TERMINAL_H) */ |