/* Interfaces to system-dependent kernel and library entries.
- Copyright (C) 1985, 86,87,88,93,94,95, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1985, 86,87,88,93,94,95, 1999, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of GNU Emacs.
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-
#include "lisp.h"
+/* 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
#endif
#endif /* macintosh */
-#define min(x,y) ((x) > (y) ? (y) : (x))
-
#ifdef WINDOWSNT
#define read sys_read
#define write sys_write
#undef fwrite
#endif
-#ifdef TRY_AGAIN
-#ifndef HAVE_H_ERRNO
-extern int h_errno;
-#endif
-#endif /* TRY_AGAIN */
-
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SPEED_T
#include <termios.h>
-extern speed_t ospeed;
#else
#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
#endif
+int emacs_ospeed;
+
/* The file descriptor for Emacs's input terminal.
Under Unix, this is normally zero except when using X;
under VMS, we place the input channel number here. */
init_baud_rate ()
{
if (noninteractive)
- ospeed = 0;
+ emacs_ospeed = 0;
else
{
#ifdef INIT_BAUD_RATE
INIT_BAUD_RATE ();
#else
#ifdef DOS_NT
- ospeed = 15;
+ emacs_ospeed = 15;
#else /* not DOS_NT */
#ifdef VMS
struct sensemode sg;
SYS$QIOW (0, input_fd, IO$_SENSEMODE, &sg, 0, 0,
&sg.class, 12, 0, 0, 0, 0 );
- ospeed = sg.xmit_baud;
+ emacs_ospeed = sg.xmit_baud;
#else /* not VMS */
#ifdef HAVE_TERMIOS
struct termios sg;
sg.c_cflag = B9600;
tcgetattr (input_fd, &sg);
- ospeed = cfgetospeed (&sg);
+ emacs_ospeed = cfgetospeed (&sg);
#if defined (USE_GETOBAUD) && defined (getobaud)
/* m88k-motorola-sysv3 needs this (ghazi@noc.rutgers.edu) 9/1/94. */
- if (ospeed == 0)
- ospeed = getobaud (sg.c_cflag);
+ if (emacs_ospeed == 0)
+ emacs_ospeed = getobaud (sg.c_cflag);
#endif
#else /* neither VMS nor TERMIOS */
#ifdef HAVE_TERMIO
#else
ioctl (input_fd, TCGETA, &sg);
#endif
- ospeed = sg.c_cflag & CBAUD;
+ emacs_ospeed = sg.c_cflag & CBAUD;
#else /* neither VMS nor TERMIOS nor TERMIO */
struct sgttyb sg;
sg.sg_ospeed = B9600;
if (ioctl (input_fd, TIOCGETP, &sg) < 0)
abort ();
- ospeed = sg.sg_ospeed;
+ emacs_ospeed = sg.sg_ospeed;
#endif /* not HAVE_TERMIO */
#endif /* not HAVE_TERMIOS */
#endif /* not VMS */
#endif /* not INIT_BAUD_RATE */
}
- baud_rate = (ospeed < sizeof baud_convert / sizeof baud_convert[0]
- ? baud_convert[ospeed] : 9600);
+ baud_rate = (emacs_ospeed < sizeof baud_convert / sizeof baud_convert[0]
+ ? baud_convert[emacs_ospeed] : 9600);
if (baud_rate == 0)
baud_rate = 1200;
}
#else /* neither BSD_SYSTEM nor UNIPLUS: random sysV */
#ifdef POSIX_SIGNALS /* would this work for 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
#endif
s.main.c_lflag &= ~ECHO; /* Disable echo */
s.main.c_lflag |= ISIG; /* Enable signals */
+#if 0
+ 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
/* 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 */
/* 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 */
{
{
update_mode_lines++;
prepare_menu_bars ();
- redisplay_preserve_echo_area ();
+ redisplay_preserve_echo_area (18);
}
}
}
#endif /* not VMS */
#endif /* not BSD4_1 */
+#ifdef TRY_AGAIN
+#ifndef HAVE_H_ERRNO
+extern int h_errno;
+#endif
+#endif /* TRY_AGAIN */
+
void
init_system_name ()
{
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 != '/')