xref: /dflybsd-src/contrib/gdb-7/gdb/terminal.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
15796c8dcSSimon Schubert /* Terminal interface definitions for GDB, the GNU Debugger.
2*ef5ccd6cSJohn Marino    Copyright (C) 1986-2013 Free Software Foundation, Inc.
35796c8dcSSimon Schubert 
45796c8dcSSimon Schubert    This file is part of GDB.
55796c8dcSSimon Schubert 
65796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
75796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
85796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
95796c8dcSSimon Schubert    (at your option) any later version.
105796c8dcSSimon Schubert 
115796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
125796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
135796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
145796c8dcSSimon Schubert    GNU General Public License for more details.
155796c8dcSSimon Schubert 
165796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
175796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
185796c8dcSSimon Schubert 
195796c8dcSSimon Schubert #if !defined (TERMINAL_H)
205796c8dcSSimon Schubert #define TERMINAL_H 1
215796c8dcSSimon Schubert 
225796c8dcSSimon Schubert 
235796c8dcSSimon Schubert /* If we're using autoconf, it will define HAVE_TERMIOS_H,
245796c8dcSSimon Schubert    HAVE_TERMIO_H and HAVE_SGTTY_H for us.  One day we can rewrite
255796c8dcSSimon Schubert    ser-unix.c and inflow.c to inspect those names instead of
265796c8dcSSimon Schubert    HAVE_TERMIOS, HAVE_TERMIO and the implicit HAVE_SGTTY (when neither
275796c8dcSSimon Schubert    HAVE_TERMIOS or HAVE_TERMIO is set).  Until then, make sure that
285796c8dcSSimon Schubert    nothing has already defined the one of the names, and do the right
295796c8dcSSimon Schubert    thing.  */
305796c8dcSSimon Schubert 
315796c8dcSSimon Schubert #if !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY)
325796c8dcSSimon Schubert #if defined(HAVE_TERMIOS_H)
335796c8dcSSimon Schubert #define HAVE_TERMIOS
345796c8dcSSimon Schubert #else /* ! defined (HAVE_TERMIOS_H) */
355796c8dcSSimon Schubert #if defined(HAVE_TERMIO_H)
365796c8dcSSimon Schubert #define HAVE_TERMIO
375796c8dcSSimon Schubert #else /* ! defined (HAVE_TERMIO_H) */
385796c8dcSSimon Schubert #if defined(HAVE_SGTTY_H)
395796c8dcSSimon Schubert #define HAVE_SGTTY
405796c8dcSSimon Schubert #endif /* ! defined (HAVE_SGTTY_H) */
415796c8dcSSimon Schubert #endif /* ! defined (HAVE_TERMIO_H) */
425796c8dcSSimon Schubert #endif /* ! defined (HAVE_TERMIOS_H) */
43c50c785cSJohn Marino #endif /* !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) &&
44c50c785cSJohn Marino 	  !defined (HAVE_SGTTY) */
455796c8dcSSimon Schubert 
465796c8dcSSimon Schubert #if defined(HAVE_TERMIOS)
475796c8dcSSimon Schubert #include <termios.h>
485796c8dcSSimon Schubert #endif
495796c8dcSSimon Schubert 
505796c8dcSSimon Schubert #if !defined(_WIN32) && !defined (HAVE_TERMIOS)
515796c8dcSSimon Schubert 
525796c8dcSSimon Schubert /* Define a common set of macros -- BSD based -- and redefine whatever
535796c8dcSSimon Schubert    the system offers to make it look like that.  FIXME: serial.h and
545796c8dcSSimon Schubert    ser-*.c deal with this in a much cleaner fashion; as soon as stuff
555796c8dcSSimon Schubert    is converted to use them, can get rid of this crap.  */
565796c8dcSSimon Schubert 
575796c8dcSSimon Schubert #ifdef HAVE_TERMIO
585796c8dcSSimon Schubert 
595796c8dcSSimon Schubert #include <termio.h>
605796c8dcSSimon Schubert 
615796c8dcSSimon Schubert #undef TIOCGETP
625796c8dcSSimon Schubert #define TIOCGETP TCGETA
635796c8dcSSimon Schubert #undef TIOCSETN
645796c8dcSSimon Schubert #define TIOCSETN TCSETA
655796c8dcSSimon Schubert #undef TIOCSETP
665796c8dcSSimon Schubert #define TIOCSETP TCSETAF
675796c8dcSSimon Schubert #define TERMINAL struct termio
685796c8dcSSimon Schubert 
695796c8dcSSimon Schubert #else /* sgtty */
705796c8dcSSimon Schubert 
715796c8dcSSimon Schubert #include <fcntl.h>
725796c8dcSSimon Schubert #include <sgtty.h>
735796c8dcSSimon Schubert #include <sys/ioctl.h>
745796c8dcSSimon Schubert #define TERMINAL struct sgttyb
755796c8dcSSimon Schubert 
765796c8dcSSimon Schubert #endif /* sgtty */
775796c8dcSSimon Schubert #endif
785796c8dcSSimon Schubert 
795796c8dcSSimon Schubert struct inferior;
805796c8dcSSimon Schubert 
815796c8dcSSimon Schubert extern void new_tty_prefork (const char *);
825796c8dcSSimon Schubert 
835796c8dcSSimon Schubert extern void new_tty (void);
845796c8dcSSimon Schubert 
855796c8dcSSimon Schubert extern void new_tty_postfork (void);
865796c8dcSSimon Schubert 
875796c8dcSSimon Schubert extern void copy_terminal_info (struct inferior *to, struct inferior *from);
885796c8dcSSimon Schubert 
895796c8dcSSimon Schubert /* Do we have job control?  Can be assumed to always be the same within
905796c8dcSSimon Schubert    a given run of GDB.  In inflow.c.  */
915796c8dcSSimon Schubert extern int job_control;
925796c8dcSSimon Schubert 
935796c8dcSSimon Schubert extern pid_t create_tty_session (void);
945796c8dcSSimon Schubert 
955796c8dcSSimon Schubert /* Set the process group of the caller to its own pid, or do nothing if
965796c8dcSSimon Schubert    we lack job control.  */
975796c8dcSSimon Schubert extern int gdb_setpgid (void);
985796c8dcSSimon Schubert 
995796c8dcSSimon Schubert /* Set up a serial structure describing standard input.  In inflow.c.  */
1005796c8dcSSimon Schubert extern void initialize_stdin_serial (void);
1015796c8dcSSimon Schubert 
1025796c8dcSSimon Schubert extern int gdb_has_a_terminal (void);
1035796c8dcSSimon Schubert 
1045796c8dcSSimon Schubert /* Set the process group of the caller to its own pid, or do nothing
1055796c8dcSSimon Schubert    if we lack job control.  */
1065796c8dcSSimon Schubert extern int gdb_setpgid (void);
1075796c8dcSSimon Schubert 
1085796c8dcSSimon Schubert #endif /* !defined (TERMINAL_H) */
109