Mercurial > emacs
diff src/process.c @ 109949:5f187a091415
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.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sun, 22 Aug 2010 08:14:37 -0700 |
parents | 64732fa6188a |
children | 015a63c2574f |
line wrap: on
line diff
--- a/src/process.c Sat Aug 21 16:26:43 2010 -0300 +++ b/src/process.c Sun Aug 22 08:14:37 2010 -0700 @@ -31,9 +31,7 @@ #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 @@ #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 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 @@ 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 @@ } -#ifdef HAVE_SERIAL DEFUN ("serial-process-configure", Fserial_process_configure, Sserial_process_configure, @@ -2865,7 +2852,6 @@ 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 @@ /* 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 @@ } /* 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 @@ #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 @@ 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 @@ 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);