]> code.delx.au - gnu-emacs/blobdiff - src/sysdep.c
(direct_output_for_insert): Set last_point_x properly.
[gnu-emacs] / src / sysdep.c
index a7026b878245dc49b7cc2273b1ba4081a823943c..098612a1bb563e62b846f94541db3664f825d0b2 100644 (file)
@@ -226,11 +226,18 @@ static int baud_convert[] =
   };
 #endif
 
-#ifdef HAVE_TERMIOS
+#if defined (HAVE_LIBNCURSES) && ! defined (NCURSES_OSPEED_T)
+extern short ospeed;
+#else
+#if defined (HAVE_TERMIOS_H) && defined (LINUX)
+#include <termios.h>
+/* HJL's version of libc is said to need this on the Alpha.
+   On the other hand, DEC OSF1 on the Alpha needs ospeed to be a short.  */
 extern speed_t ospeed;
 #else
 extern short ospeed;
 #endif
+#endif
 
 /* The file descriptor for Emacs's input terminal.
    Under Unix, this is normally zero except when using X;
@@ -312,6 +319,9 @@ init_baud_rate ()
     ospeed = 0;
   else
     {
+#ifdef INIT_BAUD_RATE
+      INIT_BAUD_RATE ();
+#else
 #ifdef DOS_NT
     ospeed = 15;
 #else  /* not DOS_NT */
@@ -355,6 +365,7 @@ init_baud_rate ()
 #endif /* not HAVE_TERMIOS */
 #endif /* not VMS */
 #endif /* not DOS_NT */
+#endif /* not INIT_BAUD_RATE */
     }
    
   baud_rate = (ospeed < sizeof baud_convert / sizeof baud_convert[0]
@@ -1206,7 +1217,7 @@ char _sobuf[BUFSIZ];
 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};
+static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1};
 #endif 
 
 init_sys_modes ()
@@ -1220,6 +1231,8 @@ init_sys_modes ()
 #endif
 #endif
 
+  Vtty_erase_char = Qnil;
+
   if (noninteractive)
     return;
 
@@ -1273,6 +1286,8 @@ init_sys_modes ()
       tty = old_tty;
 
 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
+      XSETINT (Vtty_erase_char, old_tty.main.c_cc[VERASE]);
+
 #ifdef DGUX
       /* This allows meta to be sent on 8th bit.  */
       tty.main.c_iflag &= ~INPCK;      /* don't check input for parity */
@@ -1367,6 +1382,15 @@ init_sys_modes ()
       tty.main.c_cc[VSUSP] = 255;
       tty.main.c_cc[VDSUSP] = 255;
 #endif /* IBMR2AIX */
+      if (flow_control)
+       {
+#ifdef VSTART
+         tty.main.c_cc[VSTART] = '\021';
+#endif /* VSTART */
+#ifdef VSTOP
+         tty.main.c_cc[VSTOP] = '\023';
+#endif /* VSTOP */
+       }
       /* Also, PTY overloads NUL and BREAK.
         don't ignore break, but don't signal either, so it looks like NUL.
         This really serves a purpose only if running in an XTERM window
@@ -1386,6 +1410,7 @@ init_sys_modes ()
       tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON;
 #else /* not VMS (BSD, that is) */
 #ifndef DOS_NT
+      Vtty_erase_char = tty.main.sg_erase;
       tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
       if (meta_key)
        tty.main.sg_flags |= ANYP;
@@ -2198,7 +2223,7 @@ init_system_name ()
     {
       struct hostent *hp;
       int count;
-      for (count = 0; count < 10; count++)
+      for (count = 0;; count++)
        {
 #ifdef TRY_AGAIN
          h_errno = 0;
@@ -2208,6 +2233,8 @@ init_system_name ()
          if (! (hp == 0 && h_errno == TRY_AGAIN))
 #endif
            break;
+         if (count >= 5)
+           break;
          Fsleep_for (make_number (1), Qnil);
        }
       if (hp)
@@ -2251,8 +2278,8 @@ init_system_name ()
 
       for (;;)
        {
-         char *fqdn = (char *) alloca (hostlen + 1 + domain_size);
-         char *domain = fqdn + hostlen + 1;
+         char *domain = (char *) alloca (domain_size + 1);
+         char *fqdn = (char *) alloca (hostlen + 1 + domain_size + 1);
 #if HAVE_SYSINFO && defined (SI_SRPC_DOMAIN)
          int sys_domain_size = sysinfo (SI_SRPC_DOMAIN, domain, domain_size);
          if (sys_domain_size <= 0)
@@ -2271,9 +2298,22 @@ init_system_name ()
              domain_size *= 2;
              continue;
            }
+         /* If we get an answer which means "domain unknown",
+            don't use a domain.  */
+         if (!strcmp (domain, "(none)"))
+           {
+             *domain = 0;
+             break;
+           }
 #endif /* HAVE_GETDOMAINNAME */
          strcpy (fqdn, hostname);
-         fqdn[hostlen] = '.';
+         if (domain[0] == '.')
+           strcpy (fqdn + hostlen, domain);
+         else
+           {
+             fqdn[hostlen] = '.';
+             strcpy (fqdn + hostlen + 1, domain);
+           }
          hostname = fqdn;
          break;
        }
@@ -2656,11 +2696,6 @@ init_signals ()
 signal_handler_t
 sys_signal (int signal_number, signal_handler_t action)
 {
-#ifdef DGUX
-  /* This gets us restartable system calls for efficiency.
-     The "else" code will works as well. */
-  return (berk_signal (signal_number, action));
-#else
   sigemptyset (&new_action.sa_mask);
   new_action.sa_handler = action;
 #ifdef SA_RESTART
@@ -2673,7 +2708,6 @@ sys_signal (int signal_number, signal_handler_t action)
 #endif
   sigaction (signal_number, &new_action, &old_action);
   return (old_action.sa_handler);
-#endif /* DGUX */
 }
 
 #ifndef __GNUC__