changeset 505:d5b34c57b5e7

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Thu, 16 Jan 1992 03:44:18 +0000
parents e23ef64fac27
children 5a33b571a57e
files src/emacs.c
diffstat 1 files changed, 29 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/emacs.c	Thu Jan 16 03:40:01 1992 +0000
+++ b/src/emacs.c	Thu Jan 16 03:44:18 1992 +0000
@@ -39,13 +39,16 @@
 #include <sys/ioctl.h>
 #endif
 
+#ifdef HAVE_TERMIOS
+#include <termios.h>
+#endif
+
 #ifdef APOLLO
 #ifndef APOLLO_SR10
 #include <default_acl.h>
 #endif
 #endif
 
-#undef NULL
 #include "lisp.h"
 #include "commands.h"
 
@@ -107,13 +110,10 @@
 int fatal_error_in_progress;
 
 /* Handle bus errors, illegal instruction, etc. */
+SIGTYPE
 fatal_error_signal (sig)
      int sig;
 {
-#ifdef BSD
-  int tpgrp;
-#endif /* BSD */
-
   fatal_error_code = sig;
   signal (sig, SIG_DFL);
 
@@ -124,15 +124,23 @@
   fatal_error_in_progress = 1;
 
   /* If we are controlling the terminal, reset terminal modes */
-#ifdef BSD
-  if (ioctl(0, TIOCGPGRP, &tpgrp) == 0
-      && tpgrp == getpgrp (0))
-#endif /* BSD */
-    {
-      reset_sys_modes ();
-      if (sig != SIGTERM)
-	fprintf (stderr, "Fatal error (%d).", sig);
-    }
+#if defined(TIOCGPGRP) || defined(HAVE_TERMIOS)
+  {
+    int tpgrp;
+    if (
+#ifdef HAVE_TERMIOS
+	(tpgrp = tcgetpgrp (0)) != -1
+#else
+	ioctl(0, TIOCGPGRP, &tpgrp) == 0
+#endif
+	&& tpgrp == getpgrp (0))
+      {
+	reset_sys_modes ();
+	if (sig != SIGTERM)
+	  fprintf (stderr, "Fatal error (%d).", sig);
+      }
+  }
+#endif /* uses pgrp */
 
   /* Clean up */
 #ifdef subprocesses
@@ -410,9 +418,6 @@
     }
 
   init_alloc ();
-#ifdef MAINTAIN_ENVIRONMENT
-  init_environ ();
-#endif
   init_eval ();
   init_data ();
   init_lread ();
@@ -454,9 +459,6 @@
 	 for the sake of symbols like error-message */
       syms_of_data ();
       syms_of_alloc ();
-#ifdef MAINTAIN_ENVIRONMENT
-      syms_of_environ ();
-#endif /* MAINTAIN_ENVIRONMENT */
       syms_of_lread ();
       syms_of_print ();
       syms_of_eval ();
@@ -574,7 +576,7 @@
   if (feof (stdin))
     arg = Qt;
 
-  if (!NULL (Vrun_hooks) && !noninteractive)
+  if (!NILP (Vrun_hooks) && !noninteractive)
     call1 (Vrun_hooks, intern ("kill-emacs-hook"));
 
 #ifdef subprocesses
@@ -677,7 +679,7 @@
 
   CHECK_STRING (intoname, 0);
   intoname = Fexpand_file_name (intoname, Qnil);
-  if (!NULL (symname))
+  if (!NILP (symname))
     {
       CHECK_STRING (symname, 0);
       if (XSTRING (symname)->size)
@@ -697,7 +699,7 @@
   malloc_init (&my_edata, malloc_warning);
 #endif
   unexec (XSTRING (intoname)->data,
-	  !NULL (symname) ? XSTRING (symname)->data : 0, &my_edata, 0, 0);
+	  !NILP (symname) ? XSTRING (symname)->data : 0, &my_edata, 0, 0);
 #endif /* not VMS */
 
   Vpurify_flag = tem;
@@ -724,7 +726,10 @@
 
   Lisp_Object lpath;
 
-  path = (char *) egetenv (evarname);
+  /* It's okay to use getenv here, because this function is only used
+     to initialize variables when Emacs starts up, and isn't called
+     after that.  */
+  path = (char *) getenv (evarname);
   if (!path)
     path = defalt;
   lpath = Qnil;