Simplify termio code.
All non-MSDOS non-WINDOWSNT platforms define HAVE_TERMIOS, so HAVE_TERMIO code is obsolete. Replace HAVE_TERMIOS conditionals with !DOS_NT. * src/systty.h: Do not define HAVE_TCATTR. Remove HAVE_TERMIO, HAVE_LTCHARS and HAVE_TCHARS code. Do not define EMACS_HAVE_TTY_PGRP. Only define EMACS_GET_TTY_PGRP for !DOS_NT. * src/sysdep.c: Include sysselect.h unconditionally. Do not include sys/ioctl.h and termios.h, systty.h does it. Use HAVE_SYS_UTSNAME_H instead of USG as an include guard. (init_baud_rate): Remove HAVE_TERMIO code. (child_setup_tty): Remove HAVE_TERMIO code. (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR. (new_ltchars, new_tchars): Remove, unused. (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS code. Remove special casing for __mips__, it was a no-op. Remove HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS. (init_sys_modes): Remove HPUX special case. * src/process.c: Include stdlib.h unconditionally. Do not include fcntl.h, systty.h does it. Remove conditional code for HAVE_SERIAL, it is always true. (process_send_signal): Remove HAVE_TERMIOS conditional, it's always true when SIGNALS_VIA_CHARACTERS is true. (Fcontinue_process, Fprocess_send_eof): Simplify conditionals: !WINDOWSNT means HAVE_TERMIOS. (create_process): Remove HAVE_TERMIOS, it's inside a HAVE_PTYS conditional, which is true for all HAVE_TERMIOS systems. * src/keyboard.c (init_keyboard): Do not use HAVE_TERMIO, use !DOS_NT instead of HAVE_TERMIOS. * src/emacs.c (shut_down_emacs): Use !defined DOS_NT instead of EMACS_HAVE_TTY_PGRP. * src/callproc.c (child_setup): Move EMACS_SET_TTY_PGRP use to the non-MSDOS, non-WINDOWSNT code, it's only defined for such systems anyway.
This commit is contained in:
parent
91bdeb6639
commit
a7ebc40927
7 changed files with 72 additions and 371 deletions
|
@ -1,3 +1,42 @@
|
|||
2010-08-22 Dan Nicolaescu <dann@ics.uci.edu>
|
||||
|
||||
Simplify termio code.
|
||||
All non-MSDOS non-WINDOWSNT platforms define HAVE_TERMIOS, so
|
||||
HAVE_TERMIO code is obsolete.
|
||||
Replace HAVE_TERMIOS conditionals with !DOS_NT.
|
||||
* systty.h: Do not define HAVE_TCATTR.
|
||||
Remove HAVE_TERMIO, HAVE_LTCHARS and HAVE_TCHARS code.
|
||||
Do not define EMACS_HAVE_TTY_PGRP. Only define
|
||||
EMACS_GET_TTY_PGRP for !DOS_NT.
|
||||
* sysdep.c: Include sysselect.h unconditionally. Do not include
|
||||
sys/ioctl.h and termios.h, systty.h does it. Use
|
||||
HAVE_SYS_UTSNAME_H instead of USG as an include guard.
|
||||
(init_baud_rate): Remove HAVE_TERMIO code.
|
||||
(child_setup_tty): Remove HAVE_TERMIO code.
|
||||
(emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS
|
||||
and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR.
|
||||
(new_ltchars, new_tchars): Remove, unused.
|
||||
(init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS
|
||||
code. Remove special casing for __mips__, it was a no-op. Remove
|
||||
HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS.
|
||||
(init_sys_modes): Remove HPUX special case.
|
||||
* process.c: Include stdlib.h unconditionally. Do not include
|
||||
fcntl.h, systty.h does it. Remove conditional code for
|
||||
HAVE_SERIAL, it is always true.
|
||||
(process_send_signal): Remove HAVE_TERMIOS conditional, it's
|
||||
always true when SIGNALS_VIA_CHARACTERS is true.
|
||||
(Fcontinue_process, Fprocess_send_eof): Simplify conditionals:
|
||||
!WINDOWSNT means HAVE_TERMIOS.
|
||||
(create_process): Remove HAVE_TERMIOS, it's inside a HAVE_PTYS
|
||||
conditional, which is true for all HAVE_TERMIOS systems.
|
||||
* keyboard.c (init_keyboard): Do not use HAVE_TERMIO, use !DOS_NT
|
||||
instead of HAVE_TERMIOS.
|
||||
* emacs.c (shut_down_emacs): Use !defined DOS_NT instead of
|
||||
EMACS_HAVE_TTY_PGRP.
|
||||
* callproc.c (child_setup): Move EMACS_SET_TTY_PGRP use to the
|
||||
non-MSDOS, non-WINDOWSNT code, it's only defined for such systems
|
||||
anyway.
|
||||
|
||||
2010-08-21 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* dispnew.c (buffer_posn_from_coords): Fix off-by-one error in
|
||||
|
|
|
@ -1231,8 +1231,6 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
|
|||
#else
|
||||
setpgrp (pid, pid);
|
||||
#endif /* USG */
|
||||
/* setpgrp_of_tty is incorrect here; it uses input_fd. */
|
||||
EMACS_SET_TTY_PGRP (0, &pid);
|
||||
|
||||
#ifdef MSDOS
|
||||
pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env);
|
||||
|
@ -1251,6 +1249,9 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
|
|||
report_file_error ("Spawning child process", Qnil);
|
||||
return cpid;
|
||||
#else /* not WINDOWSNT */
|
||||
/* setpgrp_of_tty is incorrect here; it uses input_fd. */
|
||||
EMACS_SET_TTY_PGRP (0, &pid);
|
||||
|
||||
/* execvp does not accept an environment arg so the only way
|
||||
to pass this environment is to set environ. Our caller
|
||||
is responsible for restoring the ambient value of environ. */
|
||||
|
|
|
@ -2096,7 +2096,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
|
|||
Vinhibit_redisplay = Qt;
|
||||
|
||||
/* If we are controlling the terminal, reset terminal modes. */
|
||||
#ifdef EMACS_HAVE_TTY_PGRP
|
||||
#ifndef DOS_NT
|
||||
{
|
||||
int pgrp = EMACS_GETPGRP (0);
|
||||
|
||||
|
|
|
@ -11506,11 +11506,11 @@ init_keyboard (void)
|
|||
Emacs on SIGINT when there are no termcap frames on the
|
||||
controlling terminal. */
|
||||
signal (SIGINT, interrupt_signal);
|
||||
#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
|
||||
#ifndef DOS_NT
|
||||
/* For systems with SysV TERMIO, C-g is set up for both SIGINT and
|
||||
SIGQUIT and we can't tell which one it will give us. */
|
||||
signal (SIGQUIT, interrupt_signal);
|
||||
#endif /* HAVE_TERMIO */
|
||||
#endif /* not DOS_NT */
|
||||
}
|
||||
/* Note SIGIO has been undef'd if FIONREAD is missing. */
|
||||
#ifdef SIGIO
|
||||
|
|
|
@ -31,9 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -61,9 +59,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#if defined(HAVE_SYS_IOCTL_H)
|
||||
#include <sys/ioctl.h>
|
||||
#if !defined (O_NDELAY) && defined (HAVE_PTYS) && !defined(USG5)
|
||||
#include <fcntl.h>
|
||||
#endif /* HAVE_PTYS and no O_NDELAY */
|
||||
#if defined(HAVE_NET_IF_H)
|
||||
#include <net/if.h>
|
||||
#endif /* HAVE_NET_IF_H */
|
||||
|
@ -182,16 +177,9 @@ extern Lisp_Object QCfilter;
|
|||
|
||||
extern const char *get_operating_system_release (void);
|
||||
|
||||
/* Serial processes require termios or Windows. */
|
||||
#if defined (HAVE_TERMIOS) || defined (WINDOWSNT)
|
||||
#define HAVE_SERIAL
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SERIAL
|
||||
/* From sysdep.c or w32.c */
|
||||
extern int serial_open (char *port);
|
||||
extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_H_ERRNO
|
||||
extern int h_errno;
|
||||
|
@ -1903,7 +1891,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
setpgrp ();
|
||||
#endif /* USG */
|
||||
#endif /* not HAVE_SETSID */
|
||||
#if defined (HAVE_TERMIOS) && defined (LDISC1)
|
||||
#if defined (LDISC1)
|
||||
if (pty_flag && xforkin >= 0)
|
||||
{
|
||||
struct termios t;
|
||||
|
@ -2569,7 +2557,6 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
|
|||
}
|
||||
|
||||
|
||||
#ifdef HAVE_SERIAL
|
||||
DEFUN ("serial-process-configure",
|
||||
Fserial_process_configure,
|
||||
Sserial_process_configure,
|
||||
|
@ -2865,7 +2852,6 @@ usage: (make-serial-process &rest ARGS) */)
|
|||
UNGCPRO;
|
||||
return proc;
|
||||
}
|
||||
#endif /* HAVE_SERIAL */
|
||||
|
||||
/* Create a network stream/datagram client/server process. Treated
|
||||
exactly like a normal process when reading and writing. Primary
|
||||
|
@ -5801,9 +5787,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
|
|||
/* If possible, send signals to the entire pgrp
|
||||
by sending an input character to it. */
|
||||
|
||||
/* TERMIOS is the latest and bestest, and seems most likely to
|
||||
work. If the system has it, use it. */
|
||||
#ifdef HAVE_TERMIOS
|
||||
struct termios t;
|
||||
cc_t *sig_char = NULL;
|
||||
|
||||
|
@ -5835,65 +5818,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
|
|||
}
|
||||
/* If we can't send the signal with a character,
|
||||
fall through and send it another way. */
|
||||
#else /* ! HAVE_TERMIOS */
|
||||
|
||||
/* On Berkeley descendants, the following IOCTL's retrieve the
|
||||
current control characters. */
|
||||
#if defined (TIOCGLTC) && defined (TIOCGETC)
|
||||
|
||||
struct tchars c;
|
||||
struct ltchars lc;
|
||||
|
||||
switch (signo)
|
||||
{
|
||||
case SIGINT:
|
||||
ioctl (p->infd, TIOCGETC, &c);
|
||||
send_process (proc, &c.t_intrc, 1, Qnil);
|
||||
return;
|
||||
case SIGQUIT:
|
||||
ioctl (p->infd, TIOCGETC, &c);
|
||||
send_process (proc, &c.t_quitc, 1, Qnil);
|
||||
return;
|
||||
#ifdef SIGTSTP
|
||||
case SIGTSTP:
|
||||
ioctl (p->infd, TIOCGLTC, &lc);
|
||||
send_process (proc, &lc.t_suspc, 1, Qnil);
|
||||
return;
|
||||
#endif /* ! defined (SIGTSTP) */
|
||||
}
|
||||
|
||||
#else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
|
||||
|
||||
/* On SYSV descendants, the TCGETA ioctl retrieves the current control
|
||||
characters. */
|
||||
#ifdef TCGETA
|
||||
struct termio t;
|
||||
switch (signo)
|
||||
{
|
||||
case SIGINT:
|
||||
ioctl (p->infd, TCGETA, &t);
|
||||
send_process (proc, &t.c_cc[VINTR], 1, Qnil);
|
||||
return;
|
||||
case SIGQUIT:
|
||||
ioctl (p->infd, TCGETA, &t);
|
||||
send_process (proc, &t.c_cc[VQUIT], 1, Qnil);
|
||||
return;
|
||||
#ifdef SIGTSTP
|
||||
case SIGTSTP:
|
||||
ioctl (p->infd, TCGETA, &t);
|
||||
send_process (proc, &t.c_cc[VSWTCH], 1, Qnil);
|
||||
return;
|
||||
#endif /* ! defined (SIGTSTP) */
|
||||
}
|
||||
#else /* ! defined (TCGETA) */
|
||||
Your configuration files are messed up.
|
||||
/* If your system configuration files define SIGNALS_VIA_CHARACTERS,
|
||||
you'd better be using one of the alternatives above! */
|
||||
#endif /* ! defined (TCGETA) */
|
||||
#endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
|
||||
/* In this case, the code above should alway return. */
|
||||
abort ();
|
||||
#endif /* ! defined HAVE_TERMIOS */
|
||||
|
||||
/* The code above may fall through if it can't
|
||||
handle the signal. */
|
||||
|
@ -6065,10 +5989,9 @@ traffic. */)
|
|||
#ifdef WINDOWSNT
|
||||
if (fd_info[ p->infd ].flags & FILE_SERIAL)
|
||||
PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR);
|
||||
#endif
|
||||
#ifdef HAVE_TERMIOS
|
||||
#else /* not WINDOWSNT */
|
||||
tcflush (p->infd, TCIFLUSH);
|
||||
#endif
|
||||
#endif /* not WINDOWSNT */
|
||||
}
|
||||
p->command = Qnil;
|
||||
return process;
|
||||
|
@ -6282,10 +6205,10 @@ process has been transmitted to the serial port. */)
|
|||
send_process (proc, "\004", 1, Qnil);
|
||||
else if (EQ (XPROCESS (proc)->type, Qserial))
|
||||
{
|
||||
#ifdef HAVE_TERMIOS
|
||||
#ifndef WINDOWSNT
|
||||
if (tcdrain (XPROCESS (proc)->outfd) != 0)
|
||||
error ("tcdrain() failed: %s", emacs_strerror (errno));
|
||||
#endif
|
||||
#endif /* not WINDOWSNT */
|
||||
/* Do nothing on Windows because writes are blocking. */
|
||||
}
|
||||
else
|
||||
|
@ -7672,10 +7595,8 @@ The variable takes effect when `start-process' is called. */);
|
|||
defsubr (&Slist_processes);
|
||||
defsubr (&Sprocess_list);
|
||||
defsubr (&Sstart_process);
|
||||
#ifdef HAVE_SERIAL
|
||||
defsubr (&Sserial_process_configure);
|
||||
defsubr (&Smake_serial_process);
|
||||
#endif /* HAVE_SERIAL */
|
||||
defsubr (&Sset_network_process_option);
|
||||
defsubr (&Smake_network_process);
|
||||
defsubr (&Sformat_network_address);
|
||||
|
|
180
src/sysdep.c
180
src/sysdep.c
|
@ -35,15 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#endif
|
||||
|
||||
#include "lisp.h"
|
||||
/* Including stdlib.h isn't necessarily enough to get srandom
|
||||
declared, e.g. without __USE_XOPEN_EXTENDED with glibc 2. */
|
||||
|
||||
/* The w32 build defines select stuff in w32.h, which is included by
|
||||
sys/select.h (included below). */
|
||||
#ifndef WINDOWSNT
|
||||
#include "sysselect.h"
|
||||
#endif
|
||||
|
||||
#include "blockinput.h"
|
||||
|
||||
#ifdef WINDOWSNT
|
||||
|
@ -84,17 +76,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSDOS
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include "systty.h"
|
||||
#include "syswait.h"
|
||||
|
||||
#if defined (USG)
|
||||
#ifdef HAVE_SYS_UTSNAME_H
|
||||
#include <sys/utsname.h>
|
||||
#include <memory.h>
|
||||
#endif /* USG */
|
||||
#endif /* HAVE_SYS_UTSNAME_H */
|
||||
|
||||
#include "keyboard.h"
|
||||
#include "frame.h"
|
||||
|
@ -149,17 +137,6 @@ static const int baud_convert[] =
|
|||
1800, 2400, 4800, 9600, 19200, 38400
|
||||
};
|
||||
|
||||
#ifdef HAVE_SPEED_T
|
||||
#include <termios.h>
|
||||
#else
|
||||
#if defined (HAVE_LIBNCURSES) && ! defined (NCURSES_OSPEED_T)
|
||||
#else
|
||||
#if defined (HAVE_TERMIOS_H) && defined (GNU_LINUX)
|
||||
#include <termios.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int emacs_ospeed;
|
||||
|
||||
void croak (char *) NO_RETURN;
|
||||
|
@ -308,32 +285,11 @@ init_baud_rate (int fd)
|
|||
#ifdef DOS_NT
|
||||
emacs_ospeed = 15;
|
||||
#else /* not DOS_NT */
|
||||
#ifdef HAVE_TERMIOS
|
||||
struct termios sg;
|
||||
|
||||
sg.c_cflag = B9600;
|
||||
tcgetattr (fd, &sg);
|
||||
emacs_ospeed = cfgetospeed (&sg);
|
||||
#else /* not TERMIOS */
|
||||
#ifdef HAVE_TERMIO
|
||||
struct termio sg;
|
||||
|
||||
sg.c_cflag = B9600;
|
||||
#ifdef HAVE_TCATTR
|
||||
tcgetattr (fd, &sg);
|
||||
#else
|
||||
ioctl (fd, TCGETA, &sg);
|
||||
#endif
|
||||
emacs_ospeed = sg.c_cflag & CBAUD;
|
||||
#else /* neither TERMIOS nor TERMIO */
|
||||
struct sgttyb sg;
|
||||
|
||||
sg.sg_ospeed = B9600;
|
||||
if (ioctl (fd, TIOCGETP, &sg) < 0)
|
||||
abort ();
|
||||
emacs_ospeed = sg.sg_ospeed;
|
||||
#endif /* not HAVE_TERMIO */
|
||||
#endif /* not HAVE_TERMIOS */
|
||||
#endif /* not DOS_NT */
|
||||
}
|
||||
|
||||
|
@ -417,7 +373,7 @@ wait_for_termination (int pid)
|
|||
void
|
||||
flush_pending_output (int channel)
|
||||
{
|
||||
#ifdef HAVE_TERMIOS
|
||||
#ifndef DOS_NT
|
||||
/* If we try this, we get hit with SIGTTIN, because
|
||||
the child's tty belongs to the child's pgrp. */
|
||||
#else
|
||||
|
@ -447,8 +403,6 @@ child_setup_tty (int out)
|
|||
struct emacs_tty s;
|
||||
|
||||
EMACS_GET_TTY (out, &s);
|
||||
|
||||
#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
|
||||
s.main.c_oflag |= OPOST; /* Enable output postprocessing */
|
||||
s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */
|
||||
#ifdef NLDLY
|
||||
|
@ -526,19 +480,7 @@ child_setup_tty (int out)
|
|||
s.main.c_cc[VTIME] = 0;
|
||||
#endif
|
||||
|
||||
#else /* not HAVE_TERMIO */
|
||||
|
||||
s.main.sg_flags &= ~(ECHO | CRMOD | ANYP | ALLDELAY | RAW | LCASE
|
||||
| CBREAK | TANDEM);
|
||||
s.main.sg_flags |= LPASS8;
|
||||
s.main.sg_erase = 0377;
|
||||
s.main.sg_kill = 0377;
|
||||
s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */
|
||||
|
||||
#endif /* not HAVE_TERMIO */
|
||||
|
||||
EMACS_SET_TTY (out, &s, 0);
|
||||
|
||||
#endif /* not WINDOWSNT */
|
||||
}
|
||||
#endif /* MSDOS */
|
||||
|
@ -841,38 +783,11 @@ int
|
|||
emacs_get_tty (int fd, struct emacs_tty *settings)
|
||||
{
|
||||
/* Retrieve the primary parameters - baud rate, character size, etcetera. */
|
||||
#ifdef HAVE_TCATTR
|
||||
#ifndef DOS_NT
|
||||
/* We have those nifty POSIX tcmumbleattr functions. */
|
||||
memset (&settings->main, 0, sizeof (settings->main));
|
||||
if (tcgetattr (fd, &settings->main) < 0)
|
||||
return -1;
|
||||
|
||||
#else
|
||||
#ifdef HAVE_TERMIO
|
||||
/* The SYSV-style interface? */
|
||||
if (ioctl (fd, TCGETA, &settings->main) < 0)
|
||||
return -1;
|
||||
|
||||
#else
|
||||
#ifndef DOS_NT
|
||||
/* I give up - I hope you have the BSD ioctls. */
|
||||
if (ioctl (fd, TIOCGETP, &settings->main) < 0)
|
||||
return -1;
|
||||
#endif /* not DOS_NT */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Suivant - Do we have to get struct ltchars data? */
|
||||
#ifdef HAVE_LTCHARS
|
||||
if (ioctl (fd, TIOCGLTC, &settings->ltchars) < 0)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
/* How about a struct tchars and a wordful of lmode bits? */
|
||||
#ifdef HAVE_TCHARS
|
||||
if (ioctl (fd, TIOCGETC, &settings->tchars) < 0
|
||||
|| ioctl (fd, TIOCLGET, &settings->lmode) < 0)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
/* We have survived the tempest. */
|
||||
|
@ -888,7 +803,7 @@ int
|
|||
emacs_set_tty (int fd, struct emacs_tty *settings, int flushp)
|
||||
{
|
||||
/* Set the primary parameters - baud rate, character size, etcetera. */
|
||||
#ifdef HAVE_TCATTR
|
||||
#ifndef DOS_NT
|
||||
int i;
|
||||
/* We have those nifty POSIX tcmumbleattr functions.
|
||||
William J. Smith <wjs@wiis.wang.com> writes:
|
||||
|
@ -926,34 +841,6 @@ emacs_set_tty (int fd, struct emacs_tty *settings, int flushp)
|
|||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef HAVE_TERMIO
|
||||
/* The SYSV-style interface? */
|
||||
if (ioctl (fd, flushp ? TCSETAF : TCSETAW, &settings->main) < 0)
|
||||
return -1;
|
||||
|
||||
#else
|
||||
#ifndef DOS_NT
|
||||
/* I give up - I hope you have the BSD ioctls. */
|
||||
if (ioctl (fd, (flushp) ? TIOCSETP : TIOCSETN, &settings->main) < 0)
|
||||
return -1;
|
||||
#endif /* not DOS_NT */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Suivant - Do we have to get struct ltchars data? */
|
||||
#ifdef HAVE_LTCHARS
|
||||
if (ioctl (fd, TIOCSLTC, &settings->ltchars) < 0)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
/* How about a struct tchars and a wordful of lmode bits? */
|
||||
#ifdef HAVE_TCHARS
|
||||
if (ioctl (fd, TIOCSETC, &settings->tchars) < 0
|
||||
|| ioctl (fd, TIOCLSET, &settings->lmode) < 0)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
/* We have survived the tempest. */
|
||||
|
@ -976,13 +863,6 @@ unsigned char _sobuf[BUFSIZ+8];
|
|||
char _sobuf[BUFSIZ];
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LTCHARS
|
||||
static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1};
|
||||
#endif
|
||||
#ifdef HAVE_TCHARS
|
||||
static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1};
|
||||
#endif
|
||||
|
||||
/* Initialize the terminal mode on all tty devices that are currently
|
||||
open. */
|
||||
|
||||
|
@ -1016,7 +896,7 @@ init_sys_modes (struct tty_display_info *tty_out)
|
|||
|
||||
tty = *tty_out->old_tty;
|
||||
|
||||
#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
|
||||
#if !defined (DOS_NT)
|
||||
XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]);
|
||||
|
||||
tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */
|
||||
|
@ -1088,12 +968,11 @@ init_sys_modes (struct tty_display_info *tty_out)
|
|||
of C-z */
|
||||
#endif /* VSWTCH */
|
||||
|
||||
#if defined (__mips__) || defined (HAVE_TCATTR)
|
||||
#ifdef VSUSP
|
||||
tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */
|
||||
tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off handling of C-z. */
|
||||
#endif /* VSUSP */
|
||||
#ifdef V_DSUSP
|
||||
tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y. */
|
||||
tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off handling of C-y. */
|
||||
#endif /* V_DSUSP */
|
||||
#ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */
|
||||
tty.main.c_cc[VDSUSP] = CDISABLE;
|
||||
|
@ -1129,7 +1008,6 @@ init_sys_modes (struct tty_display_info *tty_out)
|
|||
tty.main.c_cc[VSTOP] = CDISABLE;
|
||||
#endif /* VSTOP */
|
||||
}
|
||||
#endif /* mips or HAVE_TCATTR */
|
||||
|
||||
#ifdef AIX
|
||||
tty.main.c_cc[VSTRT] = CDISABLE;
|
||||
|
@ -1152,41 +1030,8 @@ init_sys_modes (struct tty_display_info *tty_out)
|
|||
tty.main.c_iflag &= ~IGNBRK;
|
||||
tty.main.c_iflag &= ~BRKINT;
|
||||
#endif
|
||||
#else /* if not HAVE_TERMIO */
|
||||
#ifndef DOS_NT
|
||||
XSETINT (Vtty_erase_char, tty.main.sg_erase);
|
||||
tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
|
||||
if (meta_key)
|
||||
tty.main.sg_flags |= ANYP;
|
||||
tty.main.sg_flags |= interrupt_input ? RAW : CBREAK;
|
||||
#endif /* not DOS_NT */
|
||||
#endif /* not HAVE_TERMIO */
|
||||
|
||||
/* If going to use CBREAK mode, we must request C-g to interrupt
|
||||
and turn off start and stop chars, etc. If not going to use
|
||||
CBREAK mode, do this anyway so as to turn off local flow
|
||||
control for user coming over network on 4.2; in this case,
|
||||
only t_stopc and t_startc really matter. */
|
||||
#ifndef HAVE_TERMIO
|
||||
#ifdef HAVE_TCHARS
|
||||
/* Note: if not using CBREAK mode, it makes no difference how we
|
||||
set this */
|
||||
tty.tchars = new_tchars;
|
||||
tty.tchars.t_intrc = quit_char;
|
||||
if (tty_out->flow_control)
|
||||
{
|
||||
tty.tchars.t_startc = '\021';
|
||||
tty.tchars.t_stopc = '\023';
|
||||
}
|
||||
|
||||
tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode;
|
||||
|
||||
#endif /* HAVE_TCHARS */
|
||||
#endif /* not HAVE_TERMIO */
|
||||
|
||||
#ifdef HAVE_LTCHARS
|
||||
tty.ltchars = new_ltchars;
|
||||
#endif /* HAVE_LTCHARS */
|
||||
#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
|
||||
if (!tty_out->term_initted)
|
||||
internal_terminal_init ();
|
||||
|
@ -1205,7 +1050,7 @@ init_sys_modes (struct tty_display_info *tty_out)
|
|||
if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0);
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_TERMIOS) || defined (HPUX)
|
||||
#if !defined (DOS_NT)
|
||||
#ifdef TCOON
|
||||
if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON);
|
||||
#endif
|
||||
|
@ -2688,7 +2533,7 @@ strsignal (int code)
|
|||
}
|
||||
#endif /* HAVE_STRSIGNAL */
|
||||
|
||||
#ifdef HAVE_TERMIOS
|
||||
#ifndef DOS_NT
|
||||
/* For make-serial-process */
|
||||
int
|
||||
serial_open (char *port)
|
||||
|
@ -2717,9 +2562,6 @@ serial_open (char *port)
|
|||
|
||||
return fd;
|
||||
}
|
||||
#endif /* TERMIOS */
|
||||
|
||||
#ifdef HAVE_TERMIOS
|
||||
|
||||
#if !defined (HAVE_CFMAKERAW)
|
||||
/* Workaround for targets which are missing cfmakeraw. */
|
||||
|
@ -2906,7 +2748,7 @@ serial_configure (struct Lisp_Process *p,
|
|||
p->childp = childp2;
|
||||
|
||||
}
|
||||
#endif /* TERMIOS */
|
||||
#endif /* not DOS_NT */
|
||||
|
||||
/* System depended enumeration of and access to system processes a-la ps(1). */
|
||||
|
||||
|
|
124
src/systty.h
124
src/systty.h
|
@ -17,34 +17,17 @@ GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_TERMIOS
|
||||
#define HAVE_TCATTR
|
||||
#endif
|
||||
|
||||
|
||||
/* Include the proper files. */
|
||||
#ifdef HAVE_TERMIO
|
||||
#ifndef DOS_NT
|
||||
#ifndef NO_TERMIO
|
||||
#include <termio.h>
|
||||
#endif /* not NO_TERMIO */
|
||||
#include <fcntl.h>
|
||||
#else /* not HAVE_TERMIO */
|
||||
#ifdef HAVE_TERMIOS
|
||||
#ifndef NO_TERMIO
|
||||
#include <termio.h>
|
||||
#endif
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */
|
||||
#ifndef DOS_NT
|
||||
#include <sgtty.h>
|
||||
#endif /* not DOS_NT */
|
||||
#endif /* not HAVE_TERMIOS */
|
||||
#endif /* not HAVE_TERMIO */
|
||||
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
#ifdef HPUX
|
||||
|
@ -74,17 +57,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#undef SIGIO
|
||||
#endif
|
||||
|
||||
/* On TERMIOS systems, the tcmumbleattr calls take care of these
|
||||
parameters, and it's a bad idea to use them (on AIX, it makes the
|
||||
tty hang for a long time). */
|
||||
#if defined (TIOCGLTC) && !defined (HAVE_TERMIOS)
|
||||
#define HAVE_LTCHARS
|
||||
#endif
|
||||
|
||||
#if defined (TIOCGETC) && !defined (HAVE_TERMIOS)
|
||||
#define HAVE_TCHARS
|
||||
#endif
|
||||
|
||||
|
||||
/* Try to establish the correct character to disable terminal functions
|
||||
in a system-independent manner. Note that USG (at least) define
|
||||
|
@ -111,60 +83,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size)))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TERMIO
|
||||
#ifdef TCOUTQ
|
||||
#undef EMACS_OUTQSIZE
|
||||
#define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TCOUTQ, (size)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Manipulate a terminal's current process group. */
|
||||
|
||||
/* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current
|
||||
controlling process group.
|
||||
|
||||
EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's
|
||||
/* EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's
|
||||
current process group. Return -1 if there is an error.
|
||||
|
||||
EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's
|
||||
current process group to *PGID. Return -1 if there is an error. */
|
||||
|
||||
/* HPUX tty process group stuff doesn't work, says the anonymous voice
|
||||
from the past. */
|
||||
#ifndef HPUX
|
||||
#ifdef TIOCGPGRP
|
||||
#define EMACS_HAVE_TTY_PGRP
|
||||
#else
|
||||
#ifdef HAVE_TERMIOS
|
||||
#define EMACS_HAVE_TTY_PGRP
|
||||
#endif /* HAVE_TERMIOS */
|
||||
#endif /* TIOCGPGRP */
|
||||
#endif /* not HPUX */
|
||||
|
||||
#ifdef EMACS_HAVE_TTY_PGRP
|
||||
|
||||
#if defined (HAVE_TERMIOS)
|
||||
|
||||
#ifndef DOS_NT
|
||||
#define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd)))
|
||||
#define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid)))
|
||||
|
||||
#else /* not HAVE_TERMIOS */
|
||||
#ifdef TIOCSPGRP
|
||||
|
||||
#define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid)))
|
||||
#define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid)))
|
||||
|
||||
#endif /* TIOCSPGRP */
|
||||
#endif /* HAVE_TERMIOS */
|
||||
|
||||
#else /* not EMACS_SET_TTY_PGRP */
|
||||
|
||||
/* Just ignore this for now and hope for the best */
|
||||
#define EMACS_GET_TTY_PGRP(fd, pgid) 0
|
||||
#define EMACS_SET_TTY_PGRP(fd, pgif) 0
|
||||
|
||||
#endif /* not EMACS_SET_TTY_PGRP */
|
||||
#endif /* not DOS_NT */
|
||||
|
||||
/* EMACS_GETPGRP (arg) returns the process group of the process. */
|
||||
|
||||
|
@ -207,32 +138,11 @@ struct emacs_tty {
|
|||
|
||||
/* There is always one of the following elements, so there is no need
|
||||
for dummy get and set definitions. */
|
||||
#ifdef HAVE_TCATTR
|
||||
#ifndef DOS_NT
|
||||
struct termios main;
|
||||
#else /* not HAVE_TCATTR */
|
||||
#ifdef HAVE_TERMIO
|
||||
struct termio main;
|
||||
#else /* not HAVE_TERMIO */
|
||||
#ifdef DOS_NT
|
||||
#else /* DOS_NT */
|
||||
int main;
|
||||
#else /* not DOS_NT */
|
||||
struct sgttyb main;
|
||||
#endif /* not DOS_NT */
|
||||
#endif /* not HAVE_TERMIO */
|
||||
#endif /* not HAVE_TCATTR */
|
||||
|
||||
/* If we have TERMIOS, we don't need to do this - they're taken care of
|
||||
by the tc*attr calls. */
|
||||
#ifndef HAVE_TERMIOS
|
||||
#ifdef HAVE_LTCHARS
|
||||
struct ltchars ltchars;
|
||||
#endif /* HAVE_LTCHARS */
|
||||
|
||||
#ifdef HAVE_TCHARS
|
||||
struct tchars tchars;
|
||||
int lmode;
|
||||
#endif /* HAVE_TCHARS */
|
||||
#endif /* not defined HAVE_TERMIOS */
|
||||
#endif /* DOS_NT */
|
||||
};
|
||||
|
||||
/* Define EMACS_GET_TTY and EMACS_SET_TTY,
|
||||
|
@ -249,7 +159,7 @@ extern int emacs_set_tty (int, struct emacs_tty *, int);
|
|||
|
||||
/* Define EMACS_TTY_TABS_OK. */
|
||||
|
||||
#ifdef HAVE_TERMIOS
|
||||
#ifndef DOS_NT
|
||||
|
||||
#ifdef TABDLY
|
||||
#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
|
||||
|
@ -257,21 +167,9 @@ extern int emacs_set_tty (int, struct emacs_tty *, int);
|
|||
#define EMACS_TTY_TABS_OK(p) 1
|
||||
#endif /* not TABDLY */
|
||||
|
||||
#else /* not def HAVE_TERMIOS */
|
||||
#ifdef HAVE_TERMIO
|
||||
|
||||
#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
|
||||
|
||||
#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */
|
||||
|
||||
#ifdef DOS_NT
|
||||
#else /* DOS_NT */
|
||||
#define EMACS_TTY_TABS_OK(p) 0
|
||||
#else /* not DOS_NT */
|
||||
#define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS)
|
||||
#endif /* not DOS_NT */
|
||||
|
||||
#endif /* not def HAVE_TERMIO */
|
||||
#endif /* not def HAVE_TERMIOS */
|
||||
#endif /* DOS_NT */
|
||||
|
||||
/* arch-tag: cf4b90bc-be41-401c-be98-40619178a712
|
||||
(do not change this comment) */
|
||||
|
|
Loading…
Add table
Reference in a new issue