aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-05-30 21:37:57 +0000
committerRichard M. Stallman1993-05-30 21:37:57 +0000
commite6cc3307516191803c1976fffbd6f4c6adf666e3 (patch)
tree2c9a5b8e80044ab9a51a0486e8d8eeb0261a2ff8 /src
parent0aef856135a80b4ea461fa82469f9cd3629887fb (diff)
downloademacs-e6cc3307516191803c1976fffbd6f4c6adf666e3.tar.gz
emacs-e6cc3307516191803c1976fffbd6f4c6adf666e3.zip
(child_setup_tty) [AIX SIGNALS_VIA_CHARACTERS]: Install
something usefull in the VQUIT and VINTR. (emacs_set_tty): Try only 10 times to call tcsetattr. Don't use memcmp to test what it did.
Diffstat (limited to 'src')
-rw-r--r--src/sysdep.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 167b9c398a9..16227ffb5b3 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -463,8 +463,20 @@ child_setup_tty (out)
463 /* QUIT and INTR work better as signals, so disable character forms */ 463 /* QUIT and INTR work better as signals, so disable character forms */
464 s.main.c_cc[VQUIT] = 0377; 464 s.main.c_cc[VQUIT] = 0377;
465 s.main.c_cc[VINTR] = 0377; 465 s.main.c_cc[VINTR] = 0377;
466 s.main.c_cc[VEOL] = 0377; 466#ifdef SIGNALS_VIA_CHARACTERS
467 /* the QUIT and INTR character are used in process_send_signal
468 so set them here to something useful. */
469 if (s.main.c_cc[VQUIT] == 0377)
470 s.main.c_cc[VQUIT] = '\\'&037; /* Control-\ */
471 if (s.main.c_cc[VINTR] == 0377)
472 s.main.c_cc[VINTR] = 'C'&037; /* Control-C */
473#else /* no TIOCGPGRP or no TIOCGLTC or no TIOCGETC */
474 /* QUIT and INTR work better as signals, so disable character forms */
475 s.main.c_cc[VQUIT] = 0377;
476 s.main.c_cc[VINTR] = 0377;
467 s.main.c_lflag &= ~ISIG; 477 s.main.c_lflag &= ~ISIG;
478#endif /* no TIOCGPGRP or no TIOCGLTC or no TIOCGETC */
479 s.main.c_cc[VEOL] = 0377;
468 s.main.c_cflag = (s.main.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */ 480 s.main.c_cflag = (s.main.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */
469#endif /* AIX */ 481#endif /* AIX */
470 482
@@ -805,6 +817,7 @@ emacs_set_tty (fd, settings, waitp)
805{ 817{
806 /* Set the primary parameters - baud rate, character size, etcetera. */ 818 /* Set the primary parameters - baud rate, character size, etcetera. */
807#ifdef HAVE_TCATTR 819#ifdef HAVE_TCATTR
820 int i;
808 /* We have those nifty POSIX tcmumbleattr functions. 821 /* We have those nifty POSIX tcmumbleattr functions.
809 William J. Smith <wjs@wiis.wang.com> writes: 822 William J. Smith <wjs@wiis.wang.com> writes:
810 "POSIX 1003.1 defines tcsetattr() to return success if it was 823 "POSIX 1003.1 defines tcsetattr() to return success if it was
@@ -812,7 +825,8 @@ emacs_set_tty (fd, settings, waitp)
812 of the requested actions could not be performed. 825 of the requested actions could not be performed.
813 We must read settings back to ensure tty setup properly. 826 We must read settings back to ensure tty setup properly.
814 AIX requires this to keep tty from hanging occasionally." */ 827 AIX requires this to keep tty from hanging occasionally." */
815 for (;;) 828 /* This make sure that we dont loop indefinetly in here. */
829 for (i = 0 ; i < 10 ; i++)
816 if (tcsetattr (fd, waitp ? TCSAFLUSH : TCSADRAIN, &settings->main) < 0) 830 if (tcsetattr (fd, waitp ? TCSAFLUSH : TCSADRAIN, &settings->main) < 0)
817 { 831 {
818 if (errno == EINTR) 832 if (errno == EINTR)
@@ -826,10 +840,18 @@ emacs_set_tty (fd, settings, waitp)
826 840
827 /* Get the current settings, and see if they're what we asked for. */ 841 /* Get the current settings, and see if they're what we asked for. */
828 tcgetattr (fd, &new); 842 tcgetattr (fd, &new);
829 if (memcmp (&new, &settings->main, sizeof (new))) 843 /* We cannot use memcmp on the whole structure here because under
830 continue; 844 * aix386 the termios structure has some reserved field that may
831 else 845 * not be filled in.
846 */
847 if ( new.c_iflag == settings->main.c_iflag
848 && new.c_oflag == settings->main.c_oflag
849 && new.c_cflag == settings->main.c_cflag
850 && new.c_lflag == settings->main.c_lflag
851 && memcmp(new.c_cc, settings->main.c_cc, NCCS) == 0)
832 break; 852 break;
853 else
854 continue;
833 } 855 }
834 856
835#else 857#else