diff src/sysdep.c @ 3321:d2adfd22a854

(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.
author Richard M. Stallman <rms@gnu.org>
date Sun, 30 May 1993 21:37:57 +0000
parents aaf396661221
children 7900edb84c4f
line wrap: on
line diff
--- a/src/sysdep.c	Sun May 30 21:34:53 1993 +0000
+++ b/src/sysdep.c	Sun May 30 21:37:57 1993 +0000
@@ -463,8 +463,20 @@
   /* QUIT and INTR work better as signals, so disable character forms */
   s.main.c_cc[VQUIT] = 0377;
   s.main.c_cc[VINTR] = 0377;
+#ifdef SIGNALS_VIA_CHARACTERS
+  /* the QUIT and INTR character are used in process_send_signal
+     so set them here to something useful.  */
+  if (s.main.c_cc[VQUIT] == 0377)
+    s.main.c_cc[VQUIT] = '\\'&037;	/* Control-\ */
+  if (s.main.c_cc[VINTR] == 0377)
+    s.main.c_cc[VINTR] = 'C'&037;	/* Control-C */
+#else /* no TIOCGPGRP or no TIOCGLTC or no TIOCGETC */
+  /* QUIT and INTR work better as signals, so disable character forms */
+  s.main.c_cc[VQUIT] = 0377;
+  s.main.c_cc[VINTR] = 0377;
+  s.main.c_lflag &= ~ISIG;
+#endif /* no TIOCGPGRP or no TIOCGLTC or no TIOCGETC */
   s.main.c_cc[VEOL] = 0377;
-  s.main.c_lflag &= ~ISIG;
   s.main.c_cflag = (s.main.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */
 #endif /* AIX */
 
@@ -805,6 +817,7 @@
 {
   /* Set the primary parameters - baud rate, character size, etcetera.  */
 #ifdef HAVE_TCATTR
+  int i;
   /* We have those nifty POSIX tcmumbleattr functions.
      William J. Smith <wjs@wiis.wang.com> writes:
      "POSIX 1003.1 defines tcsetattr() to return success if it was
@@ -812,7 +825,8 @@
      of the requested actions could not be performed.
      We must read settings back to ensure tty setup properly.
      AIX requires this to keep tty from hanging occasionally."  */
-  for (;;)
+  /* This make sure that we dont loop indefinetly in here.  */
+  for (i = 0 ; i < 10 ; i++)
     if (tcsetattr (fd, waitp ? TCSAFLUSH : TCSADRAIN, &settings->main) < 0)
       {
 	if (errno == EINTR)
@@ -826,10 +840,18 @@
 
 	/* Get the current settings, and see if they're what we asked for.  */
 	tcgetattr (fd, &new);
-	if (memcmp (&new, &settings->main, sizeof (new)))
+	/* We cannot use memcmp on the whole structure here because under
+	 * aix386 the termios structure has some reserved field that may
+	 * not be filled in.
+	 */
+	if (   new.c_iflag == settings->main.c_iflag
+	    && new.c_oflag == settings->main.c_oflag
+	    && new.c_cflag == settings->main.c_cflag
+	    && new.c_lflag == settings->main.c_lflag
+	    && memcmp(new.c_cc, settings->main.c_cc, NCCS) == 0)
+	  break;
+	else
 	  continue;
-	else
-	  break;
       }
 
 #else