comparison src/emacs.c @ 505:d5b34c57b5e7

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Thu, 16 Jan 1992 03:44:18 +0000
parents ba5889c7de72
children e14686fb979e
comparison
equal deleted inserted replaced
504:e23ef64fac27 505:d5b34c57b5e7
37 37
38 #ifdef BSD 38 #ifdef BSD
39 #include <sys/ioctl.h> 39 #include <sys/ioctl.h>
40 #endif 40 #endif
41 41
42 #ifdef HAVE_TERMIOS
43 #include <termios.h>
44 #endif
45
42 #ifdef APOLLO 46 #ifdef APOLLO
43 #ifndef APOLLO_SR10 47 #ifndef APOLLO_SR10
44 #include <default_acl.h> 48 #include <default_acl.h>
45 #endif 49 #endif
46 #endif 50 #endif
47 51
48 #undef NULL
49 #include "lisp.h" 52 #include "lisp.h"
50 #include "commands.h" 53 #include "commands.h"
51 54
52 #ifndef O_RDWR 55 #ifndef O_RDWR
53 #define O_RDWR 2 56 #define O_RDWR 2
105 108
106 /* Nonzero if handling a fatal error already */ 109 /* Nonzero if handling a fatal error already */
107 int fatal_error_in_progress; 110 int fatal_error_in_progress;
108 111
109 /* Handle bus errors, illegal instruction, etc. */ 112 /* Handle bus errors, illegal instruction, etc. */
113 SIGTYPE
110 fatal_error_signal (sig) 114 fatal_error_signal (sig)
111 int sig; 115 int sig;
112 { 116 {
113 #ifdef BSD
114 int tpgrp;
115 #endif /* BSD */
116
117 fatal_error_code = sig; 117 fatal_error_code = sig;
118 signal (sig, SIG_DFL); 118 signal (sig, SIG_DFL);
119 119
120 /* If fatal error occurs in code below, avoid infinite recursion. */ 120 /* If fatal error occurs in code below, avoid infinite recursion. */
121 if (fatal_error_in_progress) 121 if (fatal_error_in_progress)
122 kill (getpid (), fatal_error_code); 122 kill (getpid (), fatal_error_code);
123 123
124 fatal_error_in_progress = 1; 124 fatal_error_in_progress = 1;
125 125
126 /* If we are controlling the terminal, reset terminal modes */ 126 /* If we are controlling the terminal, reset terminal modes */
127 #ifdef BSD 127 #if defined(TIOCGPGRP) || defined(HAVE_TERMIOS)
128 if (ioctl(0, TIOCGPGRP, &tpgrp) == 0 128 {
129 && tpgrp == getpgrp (0)) 129 int tpgrp;
130 #endif /* BSD */ 130 if (
131 { 131 #ifdef HAVE_TERMIOS
132 reset_sys_modes (); 132 (tpgrp = tcgetpgrp (0)) != -1
133 if (sig != SIGTERM) 133 #else
134 fprintf (stderr, "Fatal error (%d).", sig); 134 ioctl(0, TIOCGPGRP, &tpgrp) == 0
135 } 135 #endif
136 && tpgrp == getpgrp (0))
137 {
138 reset_sys_modes ();
139 if (sig != SIGTERM)
140 fprintf (stderr, "Fatal error (%d).", sig);
141 }
142 }
143 #endif /* uses pgrp */
136 144
137 /* Clean up */ 145 /* Clean up */
138 #ifdef subprocesses 146 #ifdef subprocesses
139 kill_buffer_processes (Qnil); 147 kill_buffer_processes (Qnil);
140 #endif 148 #endif
408 /* Must precede init_window_once */ 416 /* Must precede init_window_once */
409 init_window_once (); /* Init the window system */ 417 init_window_once (); /* Init the window system */
410 } 418 }
411 419
412 init_alloc (); 420 init_alloc ();
413 #ifdef MAINTAIN_ENVIRONMENT
414 init_environ ();
415 #endif
416 init_eval (); 421 init_eval ();
417 init_data (); 422 init_data ();
418 init_lread (); 423 init_lread ();
419 424
420 init_cmdargs (argc, argv, skip_args); /* Create list Vcommand_line_args */ 425 init_cmdargs (argc, argv, skip_args); /* Create list Vcommand_line_args */
452 /* The basic levels of Lisp must come first */ 457 /* The basic levels of Lisp must come first */
453 /* And data must come first of all 458 /* And data must come first of all
454 for the sake of symbols like error-message */ 459 for the sake of symbols like error-message */
455 syms_of_data (); 460 syms_of_data ();
456 syms_of_alloc (); 461 syms_of_alloc ();
457 #ifdef MAINTAIN_ENVIRONMENT
458 syms_of_environ ();
459 #endif /* MAINTAIN_ENVIRONMENT */
460 syms_of_lread (); 462 syms_of_lread ();
461 syms_of_print (); 463 syms_of_print ();
462 syms_of_eval (); 464 syms_of_eval ();
463 syms_of_fns (); 465 syms_of_fns ();
464 #ifdef LISP_FLOAT_TYPE 466 #ifdef LISP_FLOAT_TYPE
572 GCPRO1 (arg); 574 GCPRO1 (arg);
573 575
574 if (feof (stdin)) 576 if (feof (stdin))
575 arg = Qt; 577 arg = Qt;
576 578
577 if (!NULL (Vrun_hooks) && !noninteractive) 579 if (!NILP (Vrun_hooks) && !noninteractive)
578 call1 (Vrun_hooks, intern ("kill-emacs-hook")); 580 call1 (Vrun_hooks, intern ("kill-emacs-hook"));
579 581
580 #ifdef subprocesses 582 #ifdef subprocesses
581 kill_buffer_processes (Qnil); 583 kill_buffer_processes (Qnil);
582 #endif /* subprocesses */ 584 #endif /* subprocesses */
675 Lisp_Object tem; 677 Lisp_Object tem;
676 extern void malloc_warning (); 678 extern void malloc_warning ();
677 679
678 CHECK_STRING (intoname, 0); 680 CHECK_STRING (intoname, 0);
679 intoname = Fexpand_file_name (intoname, Qnil); 681 intoname = Fexpand_file_name (intoname, Qnil);
680 if (!NULL (symname)) 682 if (!NILP (symname))
681 { 683 {
682 CHECK_STRING (symname, 0); 684 CHECK_STRING (symname, 0);
683 if (XSTRING (symname)->size) 685 if (XSTRING (symname)->size)
684 symname = Fexpand_file_name (symname, Qnil); 686 symname = Fexpand_file_name (symname, Qnil);
685 } 687 }
695 /* Also arrange for warnings when nearly out of space. */ 697 /* Also arrange for warnings when nearly out of space. */
696 #ifndef SYSTEM_MALLOC 698 #ifndef SYSTEM_MALLOC
697 malloc_init (&my_edata, malloc_warning); 699 malloc_init (&my_edata, malloc_warning);
698 #endif 700 #endif
699 unexec (XSTRING (intoname)->data, 701 unexec (XSTRING (intoname)->data,
700 !NULL (symname) ? XSTRING (symname)->data : 0, &my_edata, 0, 0); 702 !NILP (symname) ? XSTRING (symname)->data : 0, &my_edata, 0, 0);
701 #endif /* not VMS */ 703 #endif /* not VMS */
702 704
703 Vpurify_flag = tem; 705 Vpurify_flag = tem;
704 706
705 return Qnil; 707 return Qnil;
722 register char *path, *p; 724 register char *path, *p;
723 extern char *index (); 725 extern char *index ();
724 726
725 Lisp_Object lpath; 727 Lisp_Object lpath;
726 728
727 path = (char *) egetenv (evarname); 729 /* It's okay to use getenv here, because this function is only used
730 to initialize variables when Emacs starts up, and isn't called
731 after that. */
732 path = (char *) getenv (evarname);
728 if (!path) 733 if (!path)
729 path = defalt; 734 path = defalt;
730 lpath = Qnil; 735 lpath = Qnil;
731 while (1) 736 while (1)
732 { 737 {