X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/1cbd5d9dc53c354c837c568a9da8fd180eed4d89..19a36ec6dcfbb35734f4f048afdaba3cff94356d:/src/emacs.c diff --git a/src/emacs.c b/src/emacs.c index 54a39fb4d0..b288af0e2b 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -31,10 +31,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #endif -#ifdef USG5 -#include -#endif - #ifdef BSD #include #endif @@ -51,8 +47,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "lisp.h" #include "commands.h" +#include "intervals.h" -#include "systerm.h" +#include "systty.h" #ifndef O_RDWR #define O_RDWR 2 @@ -78,6 +75,11 @@ Lisp_Object Vsystem_type; but instead should use the virtual terminal under which it was started */ int inhibit_window_system; +/* If nonzero, set Emacs to run at this priority. This is also used + in child_setup and sys_suspend to make sure subshells run at normal + priority; Those functions have their own extern declaration. */ +int emacs_priority; + #ifdef HAVE_X_WINDOWS /* If non-zero, -d was specified, meaning we're using some window system. */ int display_arg; @@ -187,6 +189,23 @@ extern noshare char **environ; #endif /* LINK_CRTL_SHARE */ #endif /* VMS */ +/* We don't include crtbegin.o and crtend.o in the link, + so these functions and variables might be missed. + Provide dummy definitions to avoid error. + (We don't have any real constructors or destructors.) */ +#ifdef __GNUC__ +__do_global_ctors () +{} +__do_global_ctors_aux () +{} +__do_global_dtors () +{} +char * __CTOR_LIST__[2] = { (char *) (-1), 0 }; +char * __DTOR_LIST__[2] = { (char *) (-1), 0 }; +__main () +{} +#endif /* __GNUC__ */ + /* ARGSUSED */ main (argc, argv, envp) int argc; @@ -216,6 +235,15 @@ main (argc, argv, envp) } #endif +#ifdef NeXT + static int malloc_cookie; + + /* This helps out unexnext.c. */ + if (initialized) + if (malloc_jumpstart (malloc_cookie) != 0) + printf ("malloc jumpstart failed!\n"); +#endif /* NeXT */ + #ifdef HAVE_X_WINDOWS /* Stupid kludge to catch command-line display spec. We can't handle this argument entirely in window system dependent code @@ -285,10 +313,11 @@ main (argc, argv, envp) malloc_init (0, malloc_warning); #endif /* not SYSTEM_MALLOC */ -#ifdef HIGHPRI - setpriority (PRIO_PROCESS, getpid (), HIGHPRI); +#ifdef PRIO_PROCESS + if (emacs_priority) + nice (emacs_priority); setuid (getuid ()); -#endif /* HIGHPRI */ +#endif /* PRIO_PROCESS */ #ifdef BSD /* interrupt_input has trouble if we aren't in a separate process group. */ @@ -494,11 +523,12 @@ main (argc, argv, envp) syms_of_mocklisp (); syms_of_process (); syms_of_search (); -#ifdef MULTI_FRAME syms_of_frame (); -#endif syms_of_syntax (); syms_of_undo (); + + /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ + syms_of_textprop (); #ifdef VMS syms_of_vmsproc (); #endif /* VMS */ @@ -510,8 +540,10 @@ main (argc, argv, envp) #ifdef HAVE_X11 syms_of_xselect (); #endif -#ifdef HAVE_X_MENU +#ifdef HAVE_X_WINDOW +#ifndef NO_X_MENU syms_of_xmenu (); +#endif /* not NO_X_MENU */ #endif /* HAVE_X_MENU */ #endif /* HAVE_X_WINDOWS */ @@ -549,13 +581,22 @@ main (argc, argv, envp) initialized = 1; +#ifdef sun + /* sun's localtime() has a bug. it caches the value of the time + zone rather than looking it up every time. Since localtime() is + called to bolt the undumping time into the undumped emacs, this + results in localtime() ignoring the TZ environment variable. + This flushes the new TZ value into localtime(). */ + tzset(); +#endif /* sun */ + /* Enter editor command loop. This never returns. */ Frecursive_edit (); /* NOTREACHED */ } DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P", - "Exit the Emacs job and kill it. Ask for confirmation, without argument.\n\ + "Exit the Emacs job and kill it.\n\ If ARG is an integer, return ARG as the exit program code.\n\ If ARG is a string, stuff it as keyboard input.\n\n\ The value of `kill-emacs-hook', if not void,\n\ @@ -765,8 +806,17 @@ syms_of_emacs () DEFVAR_BOOL ("noninteractive", &noninteractive1, "Non-nil means Emacs is running without interactive terminal."); + DEFVAR_LISP ("kill-emacs-hook", &Vkill_emacs_hook, + "Hook to be run whenever kill-emacs is called.\n\ +Since kill-emacs may be invoked when the terminal is disconnected (or\n\ +in other similar situations), functions placed on this hook should not\n\ +not expect to be able to interact with the user."); Vkill_emacs_hook = Qnil; - DEFVAR_LISP ("kill-emacs-hook", &Vkill_emacs_hook, - "Hook to be run whenever kill-emacs is called."); + DEFVAR_INT ("emacs-priority", &emacs_priority, + "Priority for Emacs to run at.\n\ +This value is effective only if set before Emacs is dumped,\n\ +and only if the Emacs executable is installed with setuid to permit\n\ +it to change priority. (Emacs sets its uid back to the real uid.)"); + emacs_priority = 0; }