diff options
| author | Dan Nicolaescu | 2010-08-22 08:14:37 -0700 |
|---|---|---|
| committer | Dan Nicolaescu | 2010-08-22 08:14:37 -0700 |
| commit | a7ebc409279c0d41ad60655d360d6c3c04ae77a1 (patch) | |
| tree | fe0cb3183e7b5e5e677f015e88e3666ba8d4835b /src | |
| parent | 91bdeb6639bb1613eb91d9bb04ef7d8c78dc1d9d (diff) | |
| download | emacs-a7ebc409279c0d41ad60655d360d6c3c04ae77a1.tar.gz emacs-a7ebc409279c0d41ad60655d360d6c3c04ae77a1.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 39 | ||||
| -rw-r--r-- | src/callproc.c | 5 | ||||
| -rw-r--r-- | src/emacs.c | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 4 | ||||
| -rw-r--r-- | src/process.c | 89 | ||||
| -rw-r--r-- | src/sysdep.c | 180 | ||||
| -rw-r--r-- | src/systty.h | 124 |
7 files changed, 72 insertions, 371 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 403a588df4c..782c87642ce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,42 @@ | |||
| 1 | 2010-08-22 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | Simplify termio code. | ||
| 4 | All non-MSDOS non-WINDOWSNT platforms define HAVE_TERMIOS, so | ||
| 5 | HAVE_TERMIO code is obsolete. | ||
| 6 | Replace HAVE_TERMIOS conditionals with !DOS_NT. | ||
| 7 | * systty.h: Do not define HAVE_TCATTR. | ||
| 8 | Remove HAVE_TERMIO, HAVE_LTCHARS and HAVE_TCHARS code. | ||
| 9 | Do not define EMACS_HAVE_TTY_PGRP. Only define | ||
| 10 | EMACS_GET_TTY_PGRP for !DOS_NT. | ||
| 11 | * sysdep.c: Include sysselect.h unconditionally. Do not include | ||
| 12 | sys/ioctl.h and termios.h, systty.h does it. Use | ||
| 13 | HAVE_SYS_UTSNAME_H instead of USG as an include guard. | ||
| 14 | (init_baud_rate): Remove HAVE_TERMIO code. | ||
| 15 | (child_setup_tty): Remove HAVE_TERMIO code. | ||
| 16 | (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS | ||
| 17 | and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR. | ||
| 18 | (new_ltchars, new_tchars): Remove, unused. | ||
| 19 | (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS | ||
| 20 | code. Remove special casing for __mips__, it was a no-op. Remove | ||
| 21 | HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS. | ||
| 22 | (init_sys_modes): Remove HPUX special case. | ||
| 23 | * process.c: Include stdlib.h unconditionally. Do not include | ||
| 24 | fcntl.h, systty.h does it. Remove conditional code for | ||
| 25 | HAVE_SERIAL, it is always true. | ||
| 26 | (process_send_signal): Remove HAVE_TERMIOS conditional, it's | ||
| 27 | always true when SIGNALS_VIA_CHARACTERS is true. | ||
| 28 | (Fcontinue_process, Fprocess_send_eof): Simplify conditionals: | ||
| 29 | !WINDOWSNT means HAVE_TERMIOS. | ||
| 30 | (create_process): Remove HAVE_TERMIOS, it's inside a HAVE_PTYS | ||
| 31 | conditional, which is true for all HAVE_TERMIOS systems. | ||
| 32 | * keyboard.c (init_keyboard): Do not use HAVE_TERMIO, use !DOS_NT | ||
| 33 | instead of HAVE_TERMIOS. | ||
| 34 | * emacs.c (shut_down_emacs): Use !defined DOS_NT instead of | ||
| 35 | EMACS_HAVE_TTY_PGRP. | ||
| 36 | * callproc.c (child_setup): Move EMACS_SET_TTY_PGRP use to the | ||
| 37 | non-MSDOS, non-WINDOWSNT code, it's only defined for such systems | ||
| 38 | anyway. | ||
| 39 | |||
| 1 | 2010-08-21 Eli Zaretskii <eliz@gnu.org> | 40 | 2010-08-21 Eli Zaretskii <eliz@gnu.org> |
| 2 | 41 | ||
| 3 | * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in | 42 | * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in |
diff --git a/src/callproc.c b/src/callproc.c index de28ffa42ef..8c1384df6a1 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -1231,8 +1231,6 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1231 | #else | 1231 | #else |
| 1232 | setpgrp (pid, pid); | 1232 | setpgrp (pid, pid); |
| 1233 | #endif /* USG */ | 1233 | #endif /* USG */ |
| 1234 | /* setpgrp_of_tty is incorrect here; it uses input_fd. */ | ||
| 1235 | EMACS_SET_TTY_PGRP (0, &pid); | ||
| 1236 | 1234 | ||
| 1237 | #ifdef MSDOS | 1235 | #ifdef MSDOS |
| 1238 | pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); | 1236 | 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 | |||
| 1251 | report_file_error ("Spawning child process", Qnil); | 1249 | report_file_error ("Spawning child process", Qnil); |
| 1252 | return cpid; | 1250 | return cpid; |
| 1253 | #else /* not WINDOWSNT */ | 1251 | #else /* not WINDOWSNT */ |
| 1252 | /* setpgrp_of_tty is incorrect here; it uses input_fd. */ | ||
| 1253 | EMACS_SET_TTY_PGRP (0, &pid); | ||
| 1254 | |||
| 1254 | /* execvp does not accept an environment arg so the only way | 1255 | /* execvp does not accept an environment arg so the only way |
| 1255 | to pass this environment is to set environ. Our caller | 1256 | to pass this environment is to set environ. Our caller |
| 1256 | is responsible for restoring the ambient value of environ. */ | 1257 | is responsible for restoring the ambient value of environ. */ |
diff --git a/src/emacs.c b/src/emacs.c index 67a99d674e7..dc1453a34ac 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -2096,7 +2096,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff) | |||
| 2096 | Vinhibit_redisplay = Qt; | 2096 | Vinhibit_redisplay = Qt; |
| 2097 | 2097 | ||
| 2098 | /* If we are controlling the terminal, reset terminal modes. */ | 2098 | /* If we are controlling the terminal, reset terminal modes. */ |
| 2099 | #ifdef EMACS_HAVE_TTY_PGRP | 2099 | #ifndef DOS_NT |
| 2100 | { | 2100 | { |
| 2101 | int pgrp = EMACS_GETPGRP (0); | 2101 | int pgrp = EMACS_GETPGRP (0); |
| 2102 | 2102 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index 2fd13c4ae24..269e52988eb 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -11506,11 +11506,11 @@ init_keyboard (void) | |||
| 11506 | Emacs on SIGINT when there are no termcap frames on the | 11506 | Emacs on SIGINT when there are no termcap frames on the |
| 11507 | controlling terminal. */ | 11507 | controlling terminal. */ |
| 11508 | signal (SIGINT, interrupt_signal); | 11508 | signal (SIGINT, interrupt_signal); |
| 11509 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | 11509 | #ifndef DOS_NT |
| 11510 | /* For systems with SysV TERMIO, C-g is set up for both SIGINT and | 11510 | /* For systems with SysV TERMIO, C-g is set up for both SIGINT and |
| 11511 | SIGQUIT and we can't tell which one it will give us. */ | 11511 | SIGQUIT and we can't tell which one it will give us. */ |
| 11512 | signal (SIGQUIT, interrupt_signal); | 11512 | signal (SIGQUIT, interrupt_signal); |
| 11513 | #endif /* HAVE_TERMIO */ | 11513 | #endif /* not DOS_NT */ |
| 11514 | } | 11514 | } |
| 11515 | /* Note SIGIO has been undef'd if FIONREAD is missing. */ | 11515 | /* Note SIGIO has been undef'd if FIONREAD is missing. */ |
| 11516 | #ifdef SIGIO | 11516 | #ifdef SIGIO |
diff --git a/src/process.c b/src/process.c index 4a658623077..f348dca7d35 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -31,9 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #ifdef HAVE_INTTYPES_H | 31 | #ifdef HAVE_INTTYPES_H |
| 32 | #include <inttypes.h> | 32 | #include <inttypes.h> |
| 33 | #endif | 33 | #endif |
| 34 | #ifdef STDC_HEADERS | ||
| 35 | #include <stdlib.h> | 34 | #include <stdlib.h> |
| 36 | #endif | ||
| 37 | 35 | ||
| 38 | #ifdef HAVE_UNISTD_H | 36 | #ifdef HAVE_UNISTD_H |
| 39 | #include <unistd.h> | 37 | #include <unistd.h> |
| @@ -61,9 +59,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 61 | 59 | ||
| 62 | #if defined(HAVE_SYS_IOCTL_H) | 60 | #if defined(HAVE_SYS_IOCTL_H) |
| 63 | #include <sys/ioctl.h> | 61 | #include <sys/ioctl.h> |
| 64 | #if !defined (O_NDELAY) && defined (HAVE_PTYS) && !defined(USG5) | ||
| 65 | #include <fcntl.h> | ||
| 66 | #endif /* HAVE_PTYS and no O_NDELAY */ | ||
| 67 | #if defined(HAVE_NET_IF_H) | 62 | #if defined(HAVE_NET_IF_H) |
| 68 | #include <net/if.h> | 63 | #include <net/if.h> |
| 69 | #endif /* HAVE_NET_IF_H */ | 64 | #endif /* HAVE_NET_IF_H */ |
| @@ -182,16 +177,9 @@ extern Lisp_Object QCfilter; | |||
| 182 | 177 | ||
| 183 | extern const char *get_operating_system_release (void); | 178 | extern const char *get_operating_system_release (void); |
| 184 | 179 | ||
| 185 | /* Serial processes require termios or Windows. */ | ||
| 186 | #if defined (HAVE_TERMIOS) || defined (WINDOWSNT) | ||
| 187 | #define HAVE_SERIAL | ||
| 188 | #endif | ||
| 189 | |||
| 190 | #ifdef HAVE_SERIAL | ||
| 191 | /* From sysdep.c or w32.c */ | 180 | /* From sysdep.c or w32.c */ |
| 192 | extern int serial_open (char *port); | 181 | extern int serial_open (char *port); |
| 193 | extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact); | 182 | extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact); |
| 194 | #endif | ||
| 195 | 183 | ||
| 196 | #ifndef HAVE_H_ERRNO | 184 | #ifndef HAVE_H_ERRNO |
| 197 | extern int h_errno; | 185 | extern int h_errno; |
| @@ -1903,7 +1891,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1903 | setpgrp (); | 1891 | setpgrp (); |
| 1904 | #endif /* USG */ | 1892 | #endif /* USG */ |
| 1905 | #endif /* not HAVE_SETSID */ | 1893 | #endif /* not HAVE_SETSID */ |
| 1906 | #if defined (HAVE_TERMIOS) && defined (LDISC1) | 1894 | #if defined (LDISC1) |
| 1907 | if (pty_flag && xforkin >= 0) | 1895 | if (pty_flag && xforkin >= 0) |
| 1908 | { | 1896 | { |
| 1909 | struct termios t; | 1897 | struct termios t; |
| @@ -2569,7 +2557,6 @@ OPTION is not a supported option, return nil instead; otherwise return t. */) | |||
| 2569 | } | 2557 | } |
| 2570 | 2558 | ||
| 2571 | 2559 | ||
| 2572 | #ifdef HAVE_SERIAL | ||
| 2573 | DEFUN ("serial-process-configure", | 2560 | DEFUN ("serial-process-configure", |
| 2574 | Fserial_process_configure, | 2561 | Fserial_process_configure, |
| 2575 | Sserial_process_configure, | 2562 | Sserial_process_configure, |
| @@ -2865,7 +2852,6 @@ usage: (make-serial-process &rest ARGS) */) | |||
| 2865 | UNGCPRO; | 2852 | UNGCPRO; |
| 2866 | return proc; | 2853 | return proc; |
| 2867 | } | 2854 | } |
| 2868 | #endif /* HAVE_SERIAL */ | ||
| 2869 | 2855 | ||
| 2870 | /* Create a network stream/datagram client/server process. Treated | 2856 | /* Create a network stream/datagram client/server process. Treated |
| 2871 | exactly like a normal process when reading and writing. Primary | 2857 | 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, | |||
| 5801 | /* If possible, send signals to the entire pgrp | 5787 | /* If possible, send signals to the entire pgrp |
| 5802 | by sending an input character to it. */ | 5788 | by sending an input character to it. */ |
| 5803 | 5789 | ||
| 5804 | /* TERMIOS is the latest and bestest, and seems most likely to | ||
| 5805 | work. If the system has it, use it. */ | ||
| 5806 | #ifdef HAVE_TERMIOS | ||
| 5807 | struct termios t; | 5790 | struct termios t; |
| 5808 | cc_t *sig_char = NULL; | 5791 | cc_t *sig_char = NULL; |
| 5809 | 5792 | ||
| @@ -5835,65 +5818,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, | |||
| 5835 | } | 5818 | } |
| 5836 | /* If we can't send the signal with a character, | 5819 | /* If we can't send the signal with a character, |
| 5837 | fall through and send it another way. */ | 5820 | fall through and send it another way. */ |
| 5838 | #else /* ! HAVE_TERMIOS */ | ||
| 5839 | |||
| 5840 | /* On Berkeley descendants, the following IOCTL's retrieve the | ||
| 5841 | current control characters. */ | ||
| 5842 | #if defined (TIOCGLTC) && defined (TIOCGETC) | ||
| 5843 | |||
| 5844 | struct tchars c; | ||
| 5845 | struct ltchars lc; | ||
| 5846 | |||
| 5847 | switch (signo) | ||
| 5848 | { | ||
| 5849 | case SIGINT: | ||
| 5850 | ioctl (p->infd, TIOCGETC, &c); | ||
| 5851 | send_process (proc, &c.t_intrc, 1, Qnil); | ||
| 5852 | return; | ||
| 5853 | case SIGQUIT: | ||
| 5854 | ioctl (p->infd, TIOCGETC, &c); | ||
| 5855 | send_process (proc, &c.t_quitc, 1, Qnil); | ||
| 5856 | return; | ||
| 5857 | #ifdef SIGTSTP | ||
| 5858 | case SIGTSTP: | ||
| 5859 | ioctl (p->infd, TIOCGLTC, &lc); | ||
| 5860 | send_process (proc, &lc.t_suspc, 1, Qnil); | ||
| 5861 | return; | ||
| 5862 | #endif /* ! defined (SIGTSTP) */ | ||
| 5863 | } | ||
| 5864 | |||
| 5865 | #else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ | ||
| 5866 | |||
| 5867 | /* On SYSV descendants, the TCGETA ioctl retrieves the current control | ||
| 5868 | characters. */ | ||
| 5869 | #ifdef TCGETA | ||
| 5870 | struct termio t; | ||
| 5871 | switch (signo) | ||
| 5872 | { | ||
| 5873 | case SIGINT: | ||
| 5874 | ioctl (p->infd, TCGETA, &t); | ||
| 5875 | send_process (proc, &t.c_cc[VINTR], 1, Qnil); | ||
| 5876 | return; | ||
| 5877 | case SIGQUIT: | ||
| 5878 | ioctl (p->infd, TCGETA, &t); | ||
| 5879 | send_process (proc, &t.c_cc[VQUIT], 1, Qnil); | ||
| 5880 | return; | ||
| 5881 | #ifdef SIGTSTP | ||
| 5882 | case SIGTSTP: | ||
| 5883 | ioctl (p->infd, TCGETA, &t); | ||
| 5884 | send_process (proc, &t.c_cc[VSWTCH], 1, Qnil); | ||
| 5885 | return; | ||
| 5886 | #endif /* ! defined (SIGTSTP) */ | ||
| 5887 | } | ||
| 5888 | #else /* ! defined (TCGETA) */ | ||
| 5889 | Your configuration files are messed up. | ||
| 5890 | /* If your system configuration files define SIGNALS_VIA_CHARACTERS, | ||
| 5891 | you'd better be using one of the alternatives above! */ | ||
| 5892 | #endif /* ! defined (TCGETA) */ | ||
| 5893 | #endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ | ||
| 5894 | /* In this case, the code above should alway return. */ | ||
| 5895 | abort (); | ||
| 5896 | #endif /* ! defined HAVE_TERMIOS */ | ||
| 5897 | 5821 | ||
| 5898 | /* The code above may fall through if it can't | 5822 | /* The code above may fall through if it can't |
| 5899 | handle the signal. */ | 5823 | handle the signal. */ |
| @@ -6065,10 +5989,9 @@ traffic. */) | |||
| 6065 | #ifdef WINDOWSNT | 5989 | #ifdef WINDOWSNT |
| 6066 | if (fd_info[ p->infd ].flags & FILE_SERIAL) | 5990 | if (fd_info[ p->infd ].flags & FILE_SERIAL) |
| 6067 | PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR); | 5991 | PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR); |
| 6068 | #endif | 5992 | #else /* not WINDOWSNT */ |
| 6069 | #ifdef HAVE_TERMIOS | ||
| 6070 | tcflush (p->infd, TCIFLUSH); | 5993 | tcflush (p->infd, TCIFLUSH); |
| 6071 | #endif | 5994 | #endif /* not WINDOWSNT */ |
| 6072 | } | 5995 | } |
| 6073 | p->command = Qnil; | 5996 | p->command = Qnil; |
| 6074 | return process; | 5997 | return process; |
| @@ -6282,10 +6205,10 @@ process has been transmitted to the serial port. */) | |||
| 6282 | send_process (proc, "\004", 1, Qnil); | 6205 | send_process (proc, "\004", 1, Qnil); |
| 6283 | else if (EQ (XPROCESS (proc)->type, Qserial)) | 6206 | else if (EQ (XPROCESS (proc)->type, Qserial)) |
| 6284 | { | 6207 | { |
| 6285 | #ifdef HAVE_TERMIOS | 6208 | #ifndef WINDOWSNT |
| 6286 | if (tcdrain (XPROCESS (proc)->outfd) != 0) | 6209 | if (tcdrain (XPROCESS (proc)->outfd) != 0) |
| 6287 | error ("tcdrain() failed: %s", emacs_strerror (errno)); | 6210 | error ("tcdrain() failed: %s", emacs_strerror (errno)); |
| 6288 | #endif | 6211 | #endif /* not WINDOWSNT */ |
| 6289 | /* Do nothing on Windows because writes are blocking. */ | 6212 | /* Do nothing on Windows because writes are blocking. */ |
| 6290 | } | 6213 | } |
| 6291 | else | 6214 | else |
| @@ -7672,10 +7595,8 @@ The variable takes effect when `start-process' is called. */); | |||
| 7672 | defsubr (&Slist_processes); | 7595 | defsubr (&Slist_processes); |
| 7673 | defsubr (&Sprocess_list); | 7596 | defsubr (&Sprocess_list); |
| 7674 | defsubr (&Sstart_process); | 7597 | defsubr (&Sstart_process); |
| 7675 | #ifdef HAVE_SERIAL | ||
| 7676 | defsubr (&Sserial_process_configure); | 7598 | defsubr (&Sserial_process_configure); |
| 7677 | defsubr (&Smake_serial_process); | 7599 | defsubr (&Smake_serial_process); |
| 7678 | #endif /* HAVE_SERIAL */ | ||
| 7679 | defsubr (&Sset_network_process_option); | 7600 | defsubr (&Sset_network_process_option); |
| 7680 | defsubr (&Smake_network_process); | 7601 | defsubr (&Smake_network_process); |
| 7681 | defsubr (&Sformat_network_address); | 7602 | defsubr (&Sformat_network_address); |
diff --git a/src/sysdep.c b/src/sysdep.c index 2ae3c509522..e7d35d46bf7 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -35,15 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 35 | #endif | 35 | #endif |
| 36 | 36 | ||
| 37 | #include "lisp.h" | 37 | #include "lisp.h" |
| 38 | /* Including stdlib.h isn't necessarily enough to get srandom | ||
| 39 | declared, e.g. without __USE_XOPEN_EXTENDED with glibc 2. */ | ||
| 40 | |||
| 41 | /* The w32 build defines select stuff in w32.h, which is included by | ||
| 42 | sys/select.h (included below). */ | ||
| 43 | #ifndef WINDOWSNT | ||
| 44 | #include "sysselect.h" | 38 | #include "sysselect.h" |
| 45 | #endif | ||
| 46 | |||
| 47 | #include "blockinput.h" | 39 | #include "blockinput.h" |
| 48 | 40 | ||
| 49 | #ifdef WINDOWSNT | 41 | #ifdef WINDOWSNT |
| @@ -84,17 +76,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 84 | #include <fcntl.h> | 76 | #include <fcntl.h> |
| 85 | #endif | 77 | #endif |
| 86 | 78 | ||
| 87 | #ifndef MSDOS | ||
| 88 | #include <sys/ioctl.h> | ||
| 89 | #endif | ||
| 90 | |||
| 91 | #include "systty.h" | 79 | #include "systty.h" |
| 92 | #include "syswait.h" | 80 | #include "syswait.h" |
| 93 | 81 | ||
| 94 | #if defined (USG) | 82 | #ifdef HAVE_SYS_UTSNAME_H |
| 95 | #include <sys/utsname.h> | 83 | #include <sys/utsname.h> |
| 96 | #include <memory.h> | 84 | #include <memory.h> |
| 97 | #endif /* USG */ | 85 | #endif /* HAVE_SYS_UTSNAME_H */ |
| 98 | 86 | ||
| 99 | #include "keyboard.h" | 87 | #include "keyboard.h" |
| 100 | #include "frame.h" | 88 | #include "frame.h" |
| @@ -149,17 +137,6 @@ static const int baud_convert[] = | |||
| 149 | 1800, 2400, 4800, 9600, 19200, 38400 | 137 | 1800, 2400, 4800, 9600, 19200, 38400 |
| 150 | }; | 138 | }; |
| 151 | 139 | ||
| 152 | #ifdef HAVE_SPEED_T | ||
| 153 | #include <termios.h> | ||
| 154 | #else | ||
| 155 | #if defined (HAVE_LIBNCURSES) && ! defined (NCURSES_OSPEED_T) | ||
| 156 | #else | ||
| 157 | #if defined (HAVE_TERMIOS_H) && defined (GNU_LINUX) | ||
| 158 | #include <termios.h> | ||
| 159 | #endif | ||
| 160 | #endif | ||
| 161 | #endif | ||
| 162 | |||
| 163 | int emacs_ospeed; | 140 | int emacs_ospeed; |
| 164 | 141 | ||
| 165 | void croak (char *) NO_RETURN; | 142 | void croak (char *) NO_RETURN; |
| @@ -308,32 +285,11 @@ init_baud_rate (int fd) | |||
| 308 | #ifdef DOS_NT | 285 | #ifdef DOS_NT |
| 309 | emacs_ospeed = 15; | 286 | emacs_ospeed = 15; |
| 310 | #else /* not DOS_NT */ | 287 | #else /* not DOS_NT */ |
| 311 | #ifdef HAVE_TERMIOS | ||
| 312 | struct termios sg; | 288 | struct termios sg; |
| 313 | 289 | ||
| 314 | sg.c_cflag = B9600; | 290 | sg.c_cflag = B9600; |
| 315 | tcgetattr (fd, &sg); | 291 | tcgetattr (fd, &sg); |
| 316 | emacs_ospeed = cfgetospeed (&sg); | 292 | emacs_ospeed = cfgetospeed (&sg); |
| 317 | #else /* not TERMIOS */ | ||
| 318 | #ifdef HAVE_TERMIO | ||
| 319 | struct termio sg; | ||
| 320 | |||
| 321 | sg.c_cflag = B9600; | ||
| 322 | #ifdef HAVE_TCATTR | ||
| 323 | tcgetattr (fd, &sg); | ||
| 324 | #else | ||
| 325 | ioctl (fd, TCGETA, &sg); | ||
| 326 | #endif | ||
| 327 | emacs_ospeed = sg.c_cflag & CBAUD; | ||
| 328 | #else /* neither TERMIOS nor TERMIO */ | ||
| 329 | struct sgttyb sg; | ||
| 330 | |||
| 331 | sg.sg_ospeed = B9600; | ||
| 332 | if (ioctl (fd, TIOCGETP, &sg) < 0) | ||
| 333 | abort (); | ||
| 334 | emacs_ospeed = sg.sg_ospeed; | ||
| 335 | #endif /* not HAVE_TERMIO */ | ||
| 336 | #endif /* not HAVE_TERMIOS */ | ||
| 337 | #endif /* not DOS_NT */ | 293 | #endif /* not DOS_NT */ |
| 338 | } | 294 | } |
| 339 | 295 | ||
| @@ -417,7 +373,7 @@ wait_for_termination (int pid) | |||
| 417 | void | 373 | void |
| 418 | flush_pending_output (int channel) | 374 | flush_pending_output (int channel) |
| 419 | { | 375 | { |
| 420 | #ifdef HAVE_TERMIOS | 376 | #ifndef DOS_NT |
| 421 | /* If we try this, we get hit with SIGTTIN, because | 377 | /* If we try this, we get hit with SIGTTIN, because |
| 422 | the child's tty belongs to the child's pgrp. */ | 378 | the child's tty belongs to the child's pgrp. */ |
| 423 | #else | 379 | #else |
| @@ -447,8 +403,6 @@ child_setup_tty (int out) | |||
| 447 | struct emacs_tty s; | 403 | struct emacs_tty s; |
| 448 | 404 | ||
| 449 | EMACS_GET_TTY (out, &s); | 405 | EMACS_GET_TTY (out, &s); |
| 450 | |||
| 451 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | ||
| 452 | s.main.c_oflag |= OPOST; /* Enable output postprocessing */ | 406 | s.main.c_oflag |= OPOST; /* Enable output postprocessing */ |
| 453 | s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ | 407 | s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ |
| 454 | #ifdef NLDLY | 408 | #ifdef NLDLY |
| @@ -526,19 +480,7 @@ child_setup_tty (int out) | |||
| 526 | s.main.c_cc[VTIME] = 0; | 480 | s.main.c_cc[VTIME] = 0; |
| 527 | #endif | 481 | #endif |
| 528 | 482 | ||
| 529 | #else /* not HAVE_TERMIO */ | ||
| 530 | |||
| 531 | s.main.sg_flags &= ~(ECHO | CRMOD | ANYP | ALLDELAY | RAW | LCASE | ||
| 532 | | CBREAK | TANDEM); | ||
| 533 | s.main.sg_flags |= LPASS8; | ||
| 534 | s.main.sg_erase = 0377; | ||
| 535 | s.main.sg_kill = 0377; | ||
| 536 | s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */ | ||
| 537 | |||
| 538 | #endif /* not HAVE_TERMIO */ | ||
| 539 | |||
| 540 | EMACS_SET_TTY (out, &s, 0); | 483 | EMACS_SET_TTY (out, &s, 0); |
| 541 | |||
| 542 | #endif /* not WINDOWSNT */ | 484 | #endif /* not WINDOWSNT */ |
| 543 | } | 485 | } |
| 544 | #endif /* MSDOS */ | 486 | #endif /* MSDOS */ |
| @@ -841,38 +783,11 @@ int | |||
| 841 | emacs_get_tty (int fd, struct emacs_tty *settings) | 783 | emacs_get_tty (int fd, struct emacs_tty *settings) |
| 842 | { | 784 | { |
| 843 | /* Retrieve the primary parameters - baud rate, character size, etcetera. */ | 785 | /* Retrieve the primary parameters - baud rate, character size, etcetera. */ |
| 844 | #ifdef HAVE_TCATTR | 786 | #ifndef DOS_NT |
| 845 | /* We have those nifty POSIX tcmumbleattr functions. */ | 787 | /* We have those nifty POSIX tcmumbleattr functions. */ |
| 846 | memset (&settings->main, 0, sizeof (settings->main)); | 788 | memset (&settings->main, 0, sizeof (settings->main)); |
| 847 | if (tcgetattr (fd, &settings->main) < 0) | 789 | if (tcgetattr (fd, &settings->main) < 0) |
| 848 | return -1; | 790 | return -1; |
| 849 | |||
| 850 | #else | ||
| 851 | #ifdef HAVE_TERMIO | ||
| 852 | /* The SYSV-style interface? */ | ||
| 853 | if (ioctl (fd, TCGETA, &settings->main) < 0) | ||
| 854 | return -1; | ||
| 855 | |||
| 856 | #else | ||
| 857 | #ifndef DOS_NT | ||
| 858 | /* I give up - I hope you have the BSD ioctls. */ | ||
| 859 | if (ioctl (fd, TIOCGETP, &settings->main) < 0) | ||
| 860 | return -1; | ||
| 861 | #endif /* not DOS_NT */ | ||
| 862 | #endif | ||
| 863 | #endif | ||
| 864 | |||
| 865 | /* Suivant - Do we have to get struct ltchars data? */ | ||
| 866 | #ifdef HAVE_LTCHARS | ||
| 867 | if (ioctl (fd, TIOCGLTC, &settings->ltchars) < 0) | ||
| 868 | return -1; | ||
| 869 | #endif | ||
| 870 | |||
| 871 | /* How about a struct tchars and a wordful of lmode bits? */ | ||
| 872 | #ifdef HAVE_TCHARS | ||
| 873 | if (ioctl (fd, TIOCGETC, &settings->tchars) < 0 | ||
| 874 | || ioctl (fd, TIOCLGET, &settings->lmode) < 0) | ||
| 875 | return -1; | ||
| 876 | #endif | 791 | #endif |
| 877 | 792 | ||
| 878 | /* We have survived the tempest. */ | 793 | /* We have survived the tempest. */ |
| @@ -888,7 +803,7 @@ int | |||
| 888 | emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) | 803 | emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) |
| 889 | { | 804 | { |
| 890 | /* Set the primary parameters - baud rate, character size, etcetera. */ | 805 | /* Set the primary parameters - baud rate, character size, etcetera. */ |
| 891 | #ifdef HAVE_TCATTR | 806 | #ifndef DOS_NT |
| 892 | int i; | 807 | int i; |
| 893 | /* We have those nifty POSIX tcmumbleattr functions. | 808 | /* We have those nifty POSIX tcmumbleattr functions. |
| 894 | William J. Smith <wjs@wiis.wang.com> writes: | 809 | William J. Smith <wjs@wiis.wang.com> writes: |
| @@ -926,34 +841,6 @@ emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) | |||
| 926 | else | 841 | else |
| 927 | continue; | 842 | continue; |
| 928 | } | 843 | } |
| 929 | |||
| 930 | #else | ||
| 931 | #ifdef HAVE_TERMIO | ||
| 932 | /* The SYSV-style interface? */ | ||
| 933 | if (ioctl (fd, flushp ? TCSETAF : TCSETAW, &settings->main) < 0) | ||
| 934 | return -1; | ||
| 935 | |||
| 936 | #else | ||
| 937 | #ifndef DOS_NT | ||
| 938 | /* I give up - I hope you have the BSD ioctls. */ | ||
| 939 | if (ioctl (fd, (flushp) ? TIOCSETP : TIOCSETN, &settings->main) < 0) | ||
| 940 | return -1; | ||
| 941 | #endif /* not DOS_NT */ | ||
| 942 | |||
| 943 | #endif | ||
| 944 | #endif | ||
| 945 | |||
| 946 | /* Suivant - Do we have to get struct ltchars data? */ | ||
| 947 | #ifdef HAVE_LTCHARS | ||
| 948 | if (ioctl (fd, TIOCSLTC, &settings->ltchars) < 0) | ||
| 949 | return -1; | ||
| 950 | #endif | ||
| 951 | |||
| 952 | /* How about a struct tchars and a wordful of lmode bits? */ | ||
| 953 | #ifdef HAVE_TCHARS | ||
| 954 | if (ioctl (fd, TIOCSETC, &settings->tchars) < 0 | ||
| 955 | || ioctl (fd, TIOCLSET, &settings->lmode) < 0) | ||
| 956 | return -1; | ||
| 957 | #endif | 844 | #endif |
| 958 | 845 | ||
| 959 | /* We have survived the tempest. */ | 846 | /* We have survived the tempest. */ |
| @@ -976,13 +863,6 @@ unsigned char _sobuf[BUFSIZ+8]; | |||
| 976 | char _sobuf[BUFSIZ]; | 863 | char _sobuf[BUFSIZ]; |
| 977 | #endif | 864 | #endif |
| 978 | 865 | ||
| 979 | #ifdef HAVE_LTCHARS | ||
| 980 | static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1}; | ||
| 981 | #endif | ||
| 982 | #ifdef HAVE_TCHARS | ||
| 983 | static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1}; | ||
| 984 | #endif | ||
| 985 | |||
| 986 | /* Initialize the terminal mode on all tty devices that are currently | 866 | /* Initialize the terminal mode on all tty devices that are currently |
| 987 | open. */ | 867 | open. */ |
| 988 | 868 | ||
| @@ -1016,7 +896,7 @@ init_sys_modes (struct tty_display_info *tty_out) | |||
| 1016 | 896 | ||
| 1017 | tty = *tty_out->old_tty; | 897 | tty = *tty_out->old_tty; |
| 1018 | 898 | ||
| 1019 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | 899 | #if !defined (DOS_NT) |
| 1020 | XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); | 900 | XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); |
| 1021 | 901 | ||
| 1022 | tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */ | 902 | tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */ |
| @@ -1088,12 +968,11 @@ init_sys_modes (struct tty_display_info *tty_out) | |||
| 1088 | of C-z */ | 968 | of C-z */ |
| 1089 | #endif /* VSWTCH */ | 969 | #endif /* VSWTCH */ |
| 1090 | 970 | ||
| 1091 | #if defined (__mips__) || defined (HAVE_TCATTR) | ||
| 1092 | #ifdef VSUSP | 971 | #ifdef VSUSP |
| 1093 | tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ | 972 | tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off handling of C-z. */ |
| 1094 | #endif /* VSUSP */ | 973 | #endif /* VSUSP */ |
| 1095 | #ifdef V_DSUSP | 974 | #ifdef V_DSUSP |
| 1096 | tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y. */ | 975 | tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off handling of C-y. */ |
| 1097 | #endif /* V_DSUSP */ | 976 | #endif /* V_DSUSP */ |
| 1098 | #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */ | 977 | #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */ |
| 1099 | tty.main.c_cc[VDSUSP] = CDISABLE; | 978 | tty.main.c_cc[VDSUSP] = CDISABLE; |
| @@ -1129,7 +1008,6 @@ init_sys_modes (struct tty_display_info *tty_out) | |||
| 1129 | tty.main.c_cc[VSTOP] = CDISABLE; | 1008 | tty.main.c_cc[VSTOP] = CDISABLE; |
| 1130 | #endif /* VSTOP */ | 1009 | #endif /* VSTOP */ |
| 1131 | } | 1010 | } |
| 1132 | #endif /* mips or HAVE_TCATTR */ | ||
| 1133 | 1011 | ||
| 1134 | #ifdef AIX | 1012 | #ifdef AIX |
| 1135 | tty.main.c_cc[VSTRT] = CDISABLE; | 1013 | tty.main.c_cc[VSTRT] = CDISABLE; |
| @@ -1152,41 +1030,8 @@ init_sys_modes (struct tty_display_info *tty_out) | |||
| 1152 | tty.main.c_iflag &= ~IGNBRK; | 1030 | tty.main.c_iflag &= ~IGNBRK; |
| 1153 | tty.main.c_iflag &= ~BRKINT; | 1031 | tty.main.c_iflag &= ~BRKINT; |
| 1154 | #endif | 1032 | #endif |
| 1155 | #else /* if not HAVE_TERMIO */ | ||
| 1156 | #ifndef DOS_NT | ||
| 1157 | XSETINT (Vtty_erase_char, tty.main.sg_erase); | ||
| 1158 | tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS); | ||
| 1159 | if (meta_key) | ||
| 1160 | tty.main.sg_flags |= ANYP; | ||
| 1161 | tty.main.sg_flags |= interrupt_input ? RAW : CBREAK; | ||
| 1162 | #endif /* not DOS_NT */ | 1033 | #endif /* not DOS_NT */ |
| 1163 | #endif /* not HAVE_TERMIO */ | ||
| 1164 | |||
| 1165 | /* If going to use CBREAK mode, we must request C-g to interrupt | ||
| 1166 | and turn off start and stop chars, etc. If not going to use | ||
| 1167 | CBREAK mode, do this anyway so as to turn off local flow | ||
| 1168 | control for user coming over network on 4.2; in this case, | ||
| 1169 | only t_stopc and t_startc really matter. */ | ||
| 1170 | #ifndef HAVE_TERMIO | ||
| 1171 | #ifdef HAVE_TCHARS | ||
| 1172 | /* Note: if not using CBREAK mode, it makes no difference how we | ||
| 1173 | set this */ | ||
| 1174 | tty.tchars = new_tchars; | ||
| 1175 | tty.tchars.t_intrc = quit_char; | ||
| 1176 | if (tty_out->flow_control) | ||
| 1177 | { | ||
| 1178 | tty.tchars.t_startc = '\021'; | ||
| 1179 | tty.tchars.t_stopc = '\023'; | ||
| 1180 | } | ||
| 1181 | 1034 | ||
| 1182 | tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; | ||
| 1183 | |||
| 1184 | #endif /* HAVE_TCHARS */ | ||
| 1185 | #endif /* not HAVE_TERMIO */ | ||
| 1186 | |||
| 1187 | #ifdef HAVE_LTCHARS | ||
| 1188 | tty.ltchars = new_ltchars; | ||
| 1189 | #endif /* HAVE_LTCHARS */ | ||
| 1190 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ | 1035 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ |
| 1191 | if (!tty_out->term_initted) | 1036 | if (!tty_out->term_initted) |
| 1192 | internal_terminal_init (); | 1037 | internal_terminal_init (); |
| @@ -1205,7 +1050,7 @@ init_sys_modes (struct tty_display_info *tty_out) | |||
| 1205 | if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0); | 1050 | if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0); |
| 1206 | #endif | 1051 | #endif |
| 1207 | 1052 | ||
| 1208 | #if defined (HAVE_TERMIOS) || defined (HPUX) | 1053 | #if !defined (DOS_NT) |
| 1209 | #ifdef TCOON | 1054 | #ifdef TCOON |
| 1210 | if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON); | 1055 | if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON); |
| 1211 | #endif | 1056 | #endif |
| @@ -2688,7 +2533,7 @@ strsignal (int code) | |||
| 2688 | } | 2533 | } |
| 2689 | #endif /* HAVE_STRSIGNAL */ | 2534 | #endif /* HAVE_STRSIGNAL */ |
| 2690 | 2535 | ||
| 2691 | #ifdef HAVE_TERMIOS | 2536 | #ifndef DOS_NT |
| 2692 | /* For make-serial-process */ | 2537 | /* For make-serial-process */ |
| 2693 | int | 2538 | int |
| 2694 | serial_open (char *port) | 2539 | serial_open (char *port) |
| @@ -2717,9 +2562,6 @@ serial_open (char *port) | |||
| 2717 | 2562 | ||
| 2718 | return fd; | 2563 | return fd; |
| 2719 | } | 2564 | } |
| 2720 | #endif /* TERMIOS */ | ||
| 2721 | |||
| 2722 | #ifdef HAVE_TERMIOS | ||
| 2723 | 2565 | ||
| 2724 | #if !defined (HAVE_CFMAKERAW) | 2566 | #if !defined (HAVE_CFMAKERAW) |
| 2725 | /* Workaround for targets which are missing cfmakeraw. */ | 2567 | /* Workaround for targets which are missing cfmakeraw. */ |
| @@ -2906,7 +2748,7 @@ serial_configure (struct Lisp_Process *p, | |||
| 2906 | p->childp = childp2; | 2748 | p->childp = childp2; |
| 2907 | 2749 | ||
| 2908 | } | 2750 | } |
| 2909 | #endif /* TERMIOS */ | 2751 | #endif /* not DOS_NT */ |
| 2910 | 2752 | ||
| 2911 | /* System depended enumeration of and access to system processes a-la ps(1). */ | 2753 | /* System depended enumeration of and access to system processes a-la ps(1). */ |
| 2912 | 2754 | ||
diff --git a/src/systty.h b/src/systty.h index 39feef9c3d0..8c46411cedb 100644 --- a/src/systty.h +++ b/src/systty.h | |||
| @@ -17,34 +17,17 @@ GNU General Public License for more details. | |||
| 17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
| 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 | ||
| 20 | #ifdef HAVE_TERMIOS | ||
| 21 | #define HAVE_TCATTR | ||
| 22 | #endif | ||
| 23 | |||
| 24 | |||
| 25 | /* Include the proper files. */ | 20 | /* Include the proper files. */ |
| 26 | #ifdef HAVE_TERMIO | 21 | #ifndef DOS_NT |
| 27 | #ifndef NO_TERMIO | 22 | #ifndef NO_TERMIO |
| 28 | #include <termio.h> | 23 | #include <termio.h> |
| 29 | #endif /* not NO_TERMIO */ | 24 | #endif /* not NO_TERMIO */ |
| 30 | #include <fcntl.h> | ||
| 31 | #else /* not HAVE_TERMIO */ | ||
| 32 | #ifdef HAVE_TERMIOS | ||
| 33 | #ifndef NO_TERMIO | ||
| 34 | #include <termio.h> | ||
| 35 | #endif | ||
| 36 | #include <termios.h> | 25 | #include <termios.h> |
| 37 | #include <fcntl.h> | 26 | #include <fcntl.h> |
| 38 | #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ | ||
| 39 | #ifndef DOS_NT | ||
| 40 | #include <sgtty.h> | ||
| 41 | #endif /* not DOS_NT */ | 27 | #endif /* not DOS_NT */ |
| 42 | #endif /* not HAVE_TERMIOS */ | ||
| 43 | #endif /* not HAVE_TERMIO */ | ||
| 44 | 28 | ||
| 45 | #ifdef __GNU_LIBRARY__ | 29 | #ifdef HAVE_SYS_IOCTL_H |
| 46 | #include <sys/ioctl.h> | 30 | #include <sys/ioctl.h> |
| 47 | #include <termios.h> | ||
| 48 | #endif | 31 | #endif |
| 49 | 32 | ||
| 50 | #ifdef HPUX | 33 | #ifdef HPUX |
| @@ -74,17 +57,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 74 | #undef SIGIO | 57 | #undef SIGIO |
| 75 | #endif | 58 | #endif |
| 76 | 59 | ||
| 77 | /* On TERMIOS systems, the tcmumbleattr calls take care of these | ||
| 78 | parameters, and it's a bad idea to use them (on AIX, it makes the | ||
| 79 | tty hang for a long time). */ | ||
| 80 | #if defined (TIOCGLTC) && !defined (HAVE_TERMIOS) | ||
| 81 | #define HAVE_LTCHARS | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #if defined (TIOCGETC) && !defined (HAVE_TERMIOS) | ||
| 85 | #define HAVE_TCHARS | ||
| 86 | #endif | ||
| 87 | |||
| 88 | 60 | ||
| 89 | /* Try to establish the correct character to disable terminal functions | 61 | /* Try to establish the correct character to disable terminal functions |
| 90 | in a system-independent manner. Note that USG (at least) define | 62 | 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/>. */ | |||
| 111 | #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size))) | 83 | #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size))) |
| 112 | #endif | 84 | #endif |
| 113 | 85 | ||
| 114 | #ifdef HAVE_TERMIO | ||
| 115 | #ifdef TCOUTQ | ||
| 116 | #undef EMACS_OUTQSIZE | ||
| 117 | #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TCOUTQ, (size))) | ||
| 118 | #endif | ||
| 119 | #endif | ||
| 120 | |||
| 121 | 86 | ||
| 122 | /* Manipulate a terminal's current process group. */ | 87 | /* Manipulate a terminal's current process group. */ |
| 123 | 88 | ||
| 124 | /* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current | 89 | /* EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's |
| 125 | controlling process group. | ||
| 126 | |||
| 127 | EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's | ||
| 128 | current process group. Return -1 if there is an error. | 90 | current process group. Return -1 if there is an error. |
| 129 | 91 | ||
| 130 | EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's | 92 | EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's |
| 131 | current process group to *PGID. Return -1 if there is an error. */ | 93 | current process group to *PGID. Return -1 if there is an error. */ |
| 132 | 94 | ||
| 133 | /* HPUX tty process group stuff doesn't work, says the anonymous voice | 95 | #ifndef DOS_NT |
| 134 | from the past. */ | ||
| 135 | #ifndef HPUX | ||
| 136 | #ifdef TIOCGPGRP | ||
| 137 | #define EMACS_HAVE_TTY_PGRP | ||
| 138 | #else | ||
| 139 | #ifdef HAVE_TERMIOS | ||
| 140 | #define EMACS_HAVE_TTY_PGRP | ||
| 141 | #endif /* HAVE_TERMIOS */ | ||
| 142 | #endif /* TIOCGPGRP */ | ||
| 143 | #endif /* not HPUX */ | ||
| 144 | |||
| 145 | #ifdef EMACS_HAVE_TTY_PGRP | ||
| 146 | |||
| 147 | #if defined (HAVE_TERMIOS) | ||
| 148 | |||
| 149 | #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) | 96 | #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) |
| 150 | #define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid))) | 97 | #define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid))) |
| 151 | 98 | #endif /* not DOS_NT */ | |
| 152 | #else /* not HAVE_TERMIOS */ | ||
| 153 | #ifdef TIOCSPGRP | ||
| 154 | |||
| 155 | #define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid))) | ||
| 156 | #define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid))) | ||
| 157 | |||
| 158 | #endif /* TIOCSPGRP */ | ||
| 159 | #endif /* HAVE_TERMIOS */ | ||
| 160 | |||
| 161 | #else /* not EMACS_SET_TTY_PGRP */ | ||
| 162 | |||
| 163 | /* Just ignore this for now and hope for the best */ | ||
| 164 | #define EMACS_GET_TTY_PGRP(fd, pgid) 0 | ||
| 165 | #define EMACS_SET_TTY_PGRP(fd, pgif) 0 | ||
| 166 | |||
| 167 | #endif /* not EMACS_SET_TTY_PGRP */ | ||
| 168 | 99 | ||
| 169 | /* EMACS_GETPGRP (arg) returns the process group of the process. */ | 100 | /* EMACS_GETPGRP (arg) returns the process group of the process. */ |
| 170 | 101 | ||
| @@ -207,32 +138,11 @@ struct emacs_tty { | |||
| 207 | 138 | ||
| 208 | /* There is always one of the following elements, so there is no need | 139 | /* There is always one of the following elements, so there is no need |
| 209 | for dummy get and set definitions. */ | 140 | for dummy get and set definitions. */ |
| 210 | #ifdef HAVE_TCATTR | 141 | #ifndef DOS_NT |
| 211 | struct termios main; | 142 | struct termios main; |
| 212 | #else /* not HAVE_TCATTR */ | 143 | #else /* DOS_NT */ |
| 213 | #ifdef HAVE_TERMIO | ||
| 214 | struct termio main; | ||
| 215 | #else /* not HAVE_TERMIO */ | ||
| 216 | #ifdef DOS_NT | ||
| 217 | int main; | 144 | int main; |
| 218 | #else /* not DOS_NT */ | 145 | #endif /* DOS_NT */ |
| 219 | struct sgttyb main; | ||
| 220 | #endif /* not DOS_NT */ | ||
| 221 | #endif /* not HAVE_TERMIO */ | ||
| 222 | #endif /* not HAVE_TCATTR */ | ||
| 223 | |||
| 224 | /* If we have TERMIOS, we don't need to do this - they're taken care of | ||
| 225 | by the tc*attr calls. */ | ||
| 226 | #ifndef HAVE_TERMIOS | ||
| 227 | #ifdef HAVE_LTCHARS | ||
| 228 | struct ltchars ltchars; | ||
| 229 | #endif /* HAVE_LTCHARS */ | ||
| 230 | |||
| 231 | #ifdef HAVE_TCHARS | ||
| 232 | struct tchars tchars; | ||
| 233 | int lmode; | ||
| 234 | #endif /* HAVE_TCHARS */ | ||
| 235 | #endif /* not defined HAVE_TERMIOS */ | ||
| 236 | }; | 146 | }; |
| 237 | 147 | ||
| 238 | /* Define EMACS_GET_TTY and EMACS_SET_TTY, | 148 | /* Define EMACS_GET_TTY and EMACS_SET_TTY, |
| @@ -249,7 +159,7 @@ extern int emacs_set_tty (int, struct emacs_tty *, int); | |||
| 249 | 159 | ||
| 250 | /* Define EMACS_TTY_TABS_OK. */ | 160 | /* Define EMACS_TTY_TABS_OK. */ |
| 251 | 161 | ||
| 252 | #ifdef HAVE_TERMIOS | 162 | #ifndef DOS_NT |
| 253 | 163 | ||
| 254 | #ifdef TABDLY | 164 | #ifdef TABDLY |
| 255 | #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) | 165 | #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); | |||
| 257 | #define EMACS_TTY_TABS_OK(p) 1 | 167 | #define EMACS_TTY_TABS_OK(p) 1 |
| 258 | #endif /* not TABDLY */ | 168 | #endif /* not TABDLY */ |
| 259 | 169 | ||
| 260 | #else /* not def HAVE_TERMIOS */ | 170 | #else /* DOS_NT */ |
| 261 | #ifdef HAVE_TERMIO | ||
| 262 | |||
| 263 | #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) | ||
| 264 | |||
| 265 | #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ | ||
| 266 | |||
| 267 | #ifdef DOS_NT | ||
| 268 | #define EMACS_TTY_TABS_OK(p) 0 | 171 | #define EMACS_TTY_TABS_OK(p) 0 |
| 269 | #else /* not DOS_NT */ | 172 | #endif /* DOS_NT */ |
| 270 | #define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS) | ||
| 271 | #endif /* not DOS_NT */ | ||
| 272 | |||
| 273 | #endif /* not def HAVE_TERMIO */ | ||
| 274 | #endif /* not def HAVE_TERMIOS */ | ||
| 275 | 173 | ||
| 276 | /* arch-tag: cf4b90bc-be41-401c-be98-40619178a712 | 174 | /* arch-tag: cf4b90bc-be41-401c-be98-40619178a712 |
| 277 | (do not change this comment) */ | 175 | (do not change this comment) */ |