Test GNU_LINUX, not LINUX.
[bpt/emacs.git] / src / sysdep.c
index 8d8289d..6d0528c 100644 (file)
@@ -1,5 +1,5 @@
 /* Interfaces to system-dependent kernel and library entries.
-   Copyright (C) 1985, 86,87,88,93,94,95, 1999, 2000
+   Copyright (C) 1985, 86,87,88,93,94,95, 1999, 2000, 2001
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -30,9 +30,18 @@ Boston, MA 02111-1307, USA.  */
 /* Including stdlib.h isn't necessarily enough to get srandom
    declared, e.g. without __USE_XOPEN_EXTENDED with glibc 2.  */
 #ifdef HAVE_RANDOM
+#if 0 /* It turns out that defining _OSF_SOURCE in osf5-0.h gets
+        random prototyped as returning `int'.  It looks to me as
+        though the best way to DTRT is to prefer the rand48 functions
+        (per libc.info).  -- fx */
 extern long int random P_ ((void));
+#endif
+#if 0 /* Don't prototype srandom; it takes an unsigned argument on
+        some systems, and an unsigned long on others, like FreeBSD
+        4.1.  */
 extern void srandom P_ ((unsigned int));
 #endif
+#endif
 
 #include "blockinput.h"
 #undef NULL
@@ -49,8 +58,6 @@ static int delete_exited_processes;
 #endif
 #endif  /* macintosh */
 
-#define min(x,y) ((x) > (y) ? (y) : (x))
-
 #ifdef WINDOWSNT
 #define read sys_read
 #define write sys_write
@@ -238,7 +245,7 @@ static int baud_convert[] =
 #else
 #if defined (HAVE_LIBNCURSES) && ! defined (NCURSES_OSPEED_T)
 #else
-#if defined (HAVE_TERMIOS_H) && defined (LINUX)
+#if defined (HAVE_TERMIOS_H) && defined (GNU_LINUX)
 #include <termios.h>
 #endif
 #endif
@@ -469,13 +476,19 @@ wait_for_termination (pid)
        break;
       wait (0);
 #else /* neither BSD_SYSTEM nor UNIPLUS: random sysV */
-#ifdef POSIX_SIGNALS    /* would this work for LINUX as well? */
+#ifdef POSIX_SIGNALS    /* would this work for GNU/Linux as well? */
       sigblock (sigmask (SIGCHLD));
-      if (0 > kill (pid, 0))
+      errno = 0;
+      if (kill (pid, 0) == -1 && errno == ESRCH)
        {
          sigunblock (sigmask (SIGCHLD));
          break;
        }
+
+      /* FIXME: Since sigpause is not POSIX and its use is deprecated,
+        this should probably be `sigsuspend (&empty_mask)', which is
+        POSIX.  I'm not making that change right away because the
+        release is nearing.  2001-09-20 gerd.  */
       sigpause (SIGEMPTYMASK);
 #else /* not POSIX_SIGNALS */
 #ifdef HAVE_SYSV_SIGPAUSE
@@ -575,6 +588,13 @@ child_setup_tty (out)
 #endif
   s.main.c_lflag &= ~ECHO;     /* Disable echo */
   s.main.c_lflag |= ISIG;      /* Enable signals */
+#if 0  /* This causes bugs in (for instance) telnet to certain sites.  */
+  s.main.c_iflag &= ~ICRNL;    /* Disable map of CR to NL on input */
+#ifdef INLCR  /* Just being cautious, since I can't check how
+                widespread INLCR is--rms.  */
+  s.main.c_iflag &= ~INLCR;    /* Disable map of NL to CR on input */
+#endif
+#endif
 #ifdef IUCLC
   s.main.c_iflag &= ~IUCLC;    /* Disable downcasing on input.  */
 #endif
@@ -1276,8 +1296,8 @@ init_sys_modes ()
 /* cus-start.el complains if delete-exited-processes is not defined */
 #ifndef subprocesses
   DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes,
-    "*Non-nil means delete processes immediately when they exit.\n\
-nil means don't delete them until `list-processes' is run.");
+              doc: /* *Non-nil means delete processes immediately when they exit.
+nil means don't delete them until `list-processes' is run.  */);
   delete_exited_processes = 0;
 #endif
 #endif /* not macintosh */
@@ -2009,7 +2029,7 @@ wait_for_kbd_input ()
       /* No timing error: wait for flag to be set.  */
       set_waiting_for_input (0);
       SYS$WFLOR (input_ef, input_eflist);
-      clear_waiting_for_input (0);
+      clear_waiting_for_input ();
       if (!detect_input_pending ())
        /* Check for subprocess input availability */
        {
@@ -2024,7 +2044,7 @@ wait_for_kbd_input ()
            {
              update_mode_lines++;
              prepare_menu_bars ();
-             redisplay_preserve_echo_area ();
+             redisplay_preserve_echo_area (18);
            }
        }
     }
@@ -3340,7 +3360,10 @@ getwd (pathname)
   BLOCK_INPUT;                 /* getcwd uses malloc */
   spath = npath = getcwd ((char *) 0, MAXPATHLEN);
   if (spath == 0)
-    return spath;
+    {
+      UNBLOCK_INPUT;
+      return spath;
+    }
   /* On Altos 3068, getcwd can return @hostname/dir, so discard
      up to first slash.  Should be harmless on other systems.  */
   while (*npath && *npath != '/')