mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-09 13:10:57 -08:00
Fix implementation of the --terminal command-line switch
It sounds like this has been broken ever since multi-tty was added to Emacs. * src/keyboard.c (dev_tty): New global variable. * src/keyboard.h: Declare 'dev_tty'. * src/emacs.c (main): Initialize 'dev_tty'. * src/term.c (Fcontrolling_tty_p, Fresume_tty, init_tty): * src/process.c (dissociate_controlling_tty): * src/keyboard.c (handle_interrupt_signal, handle_interrupt) (Fset_quit_char): Use 'dev_tty' instead of 'DEV_TTY'. (Bug#70519)
This commit is contained in:
parent
1121f17d7c
commit
fa0f65aa34
5 changed files with 16 additions and 9 deletions
|
|
@ -1653,6 +1653,7 @@ main (int argc, char **argv)
|
|||
inhibit_window_system = 0;
|
||||
|
||||
/* Handle the -t switch, which specifies filename to use as terminal. */
|
||||
dev_tty = xstrdup (DEV_TTY); /* the default terminal */
|
||||
while (!only_version)
|
||||
{
|
||||
char *term;
|
||||
|
|
@ -1675,6 +1676,8 @@ main (int argc, char **argv)
|
|||
exit (EXIT_FAILURE);
|
||||
}
|
||||
fprintf (stderr, "Using %s\n", term);
|
||||
xfree (dev_tty);
|
||||
dev_tty = xstrdup (term);
|
||||
#ifdef HAVE_WINDOW_SYSTEM
|
||||
inhibit_window_system = true; /* -t => -nw */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ char const DEV_TTY[] = "CONOUT$";
|
|||
#else
|
||||
char const DEV_TTY[] = "/dev/tty";
|
||||
#endif
|
||||
char *dev_tty; /* set by init_keyboard */
|
||||
|
||||
/* Variables for blockinput.h: */
|
||||
|
||||
|
|
@ -12003,7 +12004,7 @@ static void
|
|||
handle_interrupt_signal (int sig)
|
||||
{
|
||||
/* See if we have an active terminal on our controlling tty. */
|
||||
struct terminal *terminal = get_named_terminal (DEV_TTY);
|
||||
struct terminal *terminal = get_named_terminal (dev_tty);
|
||||
if (!terminal)
|
||||
{
|
||||
/* If there are no frames there, let's pretend that we are a
|
||||
|
|
@ -12072,7 +12073,7 @@ handle_interrupt (bool in_signal_handler)
|
|||
cancel_echoing ();
|
||||
|
||||
/* XXX This code needs to be revised for multi-tty support. */
|
||||
if (!NILP (Vquit_flag) && get_named_terminal (DEV_TTY))
|
||||
if (!NILP (Vquit_flag) && get_named_terminal (dev_tty))
|
||||
{
|
||||
if (! in_signal_handler)
|
||||
{
|
||||
|
|
@ -12365,7 +12366,7 @@ process.
|
|||
See also `current-input-mode'. */)
|
||||
(Lisp_Object quit)
|
||||
{
|
||||
struct terminal *t = get_named_terminal (DEV_TTY);
|
||||
struct terminal *t = get_named_terminal (dev_tty);
|
||||
struct tty_display_info *tty;
|
||||
|
||||
if (!t)
|
||||
|
|
|
|||
|
|
@ -521,6 +521,9 @@ extern void mark_kboards (void);
|
|||
extern const char *const lispy_function_keys[];
|
||||
#endif
|
||||
|
||||
/* Terminal device used by Emacs for terminal I/O. */
|
||||
extern char *dev_tty;
|
||||
/* Initial value for dev_tty. */
|
||||
extern char const DEV_TTY[];
|
||||
|
||||
INLINE_HEADER_END
|
||||
|
|
|
|||
|
|
@ -2114,7 +2114,7 @@ dissociate_controlling_tty (void)
|
|||
child that has not execed.
|
||||
I wonder: would just ioctl (fd, TIOCNOTTY, 0) work here, for
|
||||
some fd that the caller already has? */
|
||||
int ttyfd = emacs_open (DEV_TTY, O_RDWR, 0);
|
||||
int ttyfd = emacs_open (dev_tty, O_RDWR, 0);
|
||||
if (0 <= ttyfd)
|
||||
{
|
||||
ioctl (ttyfd, TIOCNOTTY, 0);
|
||||
|
|
|
|||
10
src/term.c
10
src/term.c
|
|
@ -2312,7 +2312,7 @@ TERMINAL is not on a tty device. */)
|
|||
{
|
||||
struct terminal *t = decode_tty_terminal (terminal);
|
||||
|
||||
return (t && !strcmp (t->display_info.tty->name, DEV_TTY) ? Qt : Qnil);
|
||||
return (t && !strcmp (t->display_info.tty->name, dev_tty) ? Qt : Qnil);
|
||||
}
|
||||
|
||||
DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0,
|
||||
|
|
@ -2467,7 +2467,7 @@ frame's terminal). */)
|
|||
open_errno);
|
||||
}
|
||||
|
||||
if (!O_IGNORE_CTTY && strcmp (t->display_info.tty->name, DEV_TTY) != 0)
|
||||
if (!O_IGNORE_CTTY && strcmp (t->display_info.tty->name, dev_tty) != 0)
|
||||
dissociate_if_controlling_tty (fd);
|
||||
#endif /* MSDOS */
|
||||
|
||||
|
|
@ -4075,7 +4075,7 @@ dissociate_if_controlling_tty (int fd)
|
|||
/* Create a termcap display on the tty device with the given name and
|
||||
type.
|
||||
|
||||
If NAME is NULL, then use the controlling tty, i.e., DEV_TTY.
|
||||
If NAME is NULL, then use the controlling tty, i.e., dev_tty.
|
||||
Otherwise NAME should be a path to the tty device file,
|
||||
e.g. "/dev/pts/7".
|
||||
|
||||
|
|
@ -4114,9 +4114,9 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
|
|||
"Unknown terminal type");
|
||||
|
||||
if (name == NULL)
|
||||
name = DEV_TTY;
|
||||
name = dev_tty;
|
||||
#ifndef DOS_NT
|
||||
if (!strcmp (name, DEV_TTY))
|
||||
if (!strcmp (name, dev_tty))
|
||||
ctty = 1;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue