#undef fwrite
#endif
+#ifndef HAVE_H_ERRNO
+extern int h_errno;
+#endif
+
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
sg.c_cflag = B9600;
tcgetattr (input_fd, &sg);
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);
+#endif
#else /* neither VMS nor TERMIOS */
#ifdef HAVE_TERMIO
struct termio sg;
int st;
char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */
#endif
- int pid = fork ();
+ int pid;
struct save_signal saved_handlers[5];
+ Lisp_Object dir;
+ unsigned char *str = 0;
+ int len;
saved_handlers[0].code = SIGINT;
saved_handlers[1].code = SIGQUIT;
saved_handlers[3].code = 0;
#endif
+ /* Mentioning current_buffer->buffer would mean including buffer.h,
+ which somehow wedges the hp compiler. So instead... */
+
+ dir = intern ("default-directory");
+ /* Can't use NILP */
+ if (XFASTINT (Fboundp (dir)) == XFASTINT (Qnil))
+ goto xyzzy;
+ dir = Fsymbol_value (dir);
+ if (XTYPE (dir) != Lisp_String)
+ goto xyzzy;
+
+ dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil);
+ str = (unsigned char *) alloca (XSTRING (dir)->size + 2);
+ len = XSTRING (dir)->size;
+ bcopy (XSTRING (dir)->data, str, len);
+ if (str[len - 1] != '/') str[len++] = '/';
+ str[len] = 0;
+ xyzzy:
+
+ pid = vfork ();
+
if (pid == -1)
error ("Can't spawn subshell");
if (pid == 0)
sh = "sh";
/* Use our buffer's default directory for the subshell. */
- {
- Lisp_Object dir;
- unsigned char *str;
- int len;
-
- /* mentioning current_buffer->buffer would mean including buffer.h,
- which somehow wedges the hp compiler. So instead... */
-
- dir = intern ("default-directory");
- /* Can't use NILP */
- if (XFASTINT (Fboundp (dir)) == XFASTINT (Qnil))
- goto xyzzy;
- dir = Fsymbol_value (dir);
- if (XTYPE (dir) != Lisp_String)
- goto xyzzy;
-
- str = (unsigned char *) alloca (XSTRING (dir)->size + 2);
- len = XSTRING (dir)->size;
- bcopy (XSTRING (dir)->data, str, len);
- if (str[len - 1] != '/') str[len++] = '/';
- str[len] = 0;
+ if (str)
chdir (str);
- }
- xyzzy:
+
#ifdef subprocesses
close_process_descs (); /* Close Emacs's pipes/ptys */
#endif
tty = old_tty;
#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
+#ifdef DGUX
+ /* This allows meta to be sent on 8th bit. */
+ tty.main.c_iflag &= ~INPCK; /* don't check input for parity */
+#endif
tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */
tty.main.c_iflag &= ~ICRNL; /* Disable map of CR to NL on input */
#ifdef ISTRIP
#ifdef VDISCARD
tty.main.c_cc[VDISCARD] = CDISABLE;
#endif /* VDISCARD */
+#ifdef VSTART
+ tty.main.c_cc[VSTART] = CDISABLE;
+#endif /* VSTART */
+#ifdef VSTOP
+ tty.main.c_cc[VSTOP] = CDISABLE;
+#endif /* VSTOP */
#endif /* mips or HAVE_TCATTR */
#ifdef AIX
#ifndef IBMR2AIX
if (initialized)
#endif /* not CANNOT_DUMP */
{
- struct hostent *hp = gethostbyname (hostname);
+ struct hostent *hp;
+ int count;
+ for (count = 0; count < 10; count++)
+ {
+#ifdef TRY_AGAIN
+ h_errno = 0;
+#endif
+ hp = gethostbyname (hostname);
+#ifdef TRY_AGAIN
+ if (! (hp == 0 && h_errno == TRY_AGAIN))
+#endif
+ break;
+ Fsleep_for (make_number (1), Qnil);
+ }
if (hp)
{
char *fqdn = hp->h_name;
#endif /* not BSTRING */
\f
#ifndef HAVE_RANDOM
-#ifdef USG
+#ifndef random
+
/*
* The BSD random returns numbers in the range of
* 0 to 2e31 - 1. The USG rand returns numbers in the
long
random ()
{
- /* Arrange to return a range centered on zero. */
- return (rand () << 15) + rand () - (1 << 29);
+#ifdef HAVE_LRAND48
+ return lrand48 ();
+#else
+/* The BSD rand returns numbers in the range of 0 to 2e31 - 1,
+ with unusable least significant bits. The USG rand returns
+ numbers in the range of 0 to 2e15 - 1, all usable. Let us
+ build a usable 30 bit number from either. */
+#ifdef USG
+ return (rand () << 15) + rand ();
+#else
+ return (rand () & 0x3fff8000) + (rand () >> 16);
+#endif
+#endif
}
srandom (arg)
int arg;
{
+#ifdef HAVE_LRAND48
+ return srand48 ();
+#else
srand (arg);
+#endif
}
-#endif /* USG */
-
-#ifdef BSD4_1
-long random ()
-{
- /* Arrange to return a range centered on zero. */
- return (rand () << 15) + rand () - (1 << 29);
-}
-
-srandom (arg)
- int arg;
-{
- srand (arg);
-}
-#endif /* BSD4_1 */
-#endif
+#endif /* no random */
+#endif /* not HAVE_RANDOM */
\f
#ifdef WRONG_NAME_INSQUE