/* Fully extensible Emacs, running on Unix, intended for GNU.
-Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2011
Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <sys/types.h>
#include <sys/file.h>
#include <setjmp.h>
-
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif
#ifdef WINDOWSNT
#include <fcntl.h>
/* If you change the following line, remember to update
msdos/mainmake.v2 which gleans the Emacs version from it! */
-static const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
static const char emacs_version[] = "24.0.50";
+static const char emacs_copyright[] = "Copyright (C) 2011 Free Software Foundation, Inc.";
/* Make these values available in GDB, which doesn't see macros. */
#ifdef USE_LSB_TAG
-int gdb_use_lsb = 1;
+int gdb_use_lsb EXTERNALLY_VISIBLE = 1;
#else
-int gdb_use_lsb = 0;
+int gdb_use_lsb EXTERNALLY_VISIBLE = 0;
#endif
#ifndef USE_LISP_UNION_TYPE
-int gdb_use_union = 0;
+int gdb_use_union EXTERNALLY_VISIBLE = 0;
#else
-int gdb_use_union = 1;
+int gdb_use_union EXTERNALLY_VISIBLE = 1;
#endif
-EMACS_INT gdb_valbits = VALBITS;
-EMACS_INT gdb_gctypebits = GCTYPEBITS;
+EMACS_INT gdb_valbits EXTERNALLY_VISIBLE = VALBITS;
+EMACS_INT gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS;
#if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG)
-EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS;
+EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS;
#else
-EMACS_INT gdb_data_seg_bits = 0;
+EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = 0;
#endif
-EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG;
-EMACS_INT gdb_array_mark_flag = ARRAY_MARK_FLAG;
+EMACS_INT PVEC_FLAG EXTERNALLY_VISIBLE = PSEUDOVECTOR_FLAG;
+EMACS_INT gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG;
/* GDB might say "No enum type named pvec_type" if we don't have at
least one symbol with that type, and then xbacktrace could fail. */
-enum pvec_type gdb_pvec_type = PVEC_TYPE_MASK;
-
-/* Command line args from shell, as list of strings. */
-Lisp_Object Vcommand_line_args;
-
-/* The name under which Emacs was invoked, with any leading directory
- names discarded. */
-Lisp_Object Vinvocation_name;
-
-/* The directory name from which Emacs was invoked. */
-Lisp_Object Vinvocation_directory;
-
-/* The directory name in which to find subdirs such as lisp and etc.
- nil means get them only from PATH_LOADSEARCH. */
-Lisp_Object Vinstallation_directory;
-
-/* The values of `current-time' before and after Emacs initialization. */
-Lisp_Object Vbefore_init_time, Vafter_init_time;
-
-/* Hook run by `kill-emacs' before it does really anything. */
-Lisp_Object Vkill_emacs_hook;
+enum pvec_type gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK;
/* Empty lisp strings. To avoid having to build any others. */
Lisp_Object empty_unibyte_string, empty_multibyte_string;
-/* Search path separator. */
-Lisp_Object Vpath_separator;
-
/* Set nonzero after Emacs has started up the first time.
Prevents reinitialization of the Lisp world and keymaps
on subsequent starts. */
int malloc_using_checking;
#endif
-/* Variable whose value is symbol giving operating system type. */
-Lisp_Object Vsystem_type;
-
-/* Variable whose value is string giving configuration built for. */
-Lisp_Object Vsystem_configuration;
-
-/* Variable whose value is string giving configuration options,
- for use when reporting bugs. */
-Lisp_Object Vsystem_configuration_options;
-
Lisp_Object Qfile_name_handler_alist;
-/* Current and previous system locales for messages and time. */
-Lisp_Object Vsystem_messages_locale;
-Lisp_Object Vprevious_system_messages_locale;
-Lisp_Object Vsystem_time_locale;
-Lisp_Object Vprevious_system_time_locale;
-
-/* Copyright and version info. The version number may be updated by
- Lisp code. */
-Lisp_Object Vemacs_copyright, Vemacs_version;
-
-/* Alist of external libraries and files implementing them. */
-Lisp_Object Vdynamic_library_alist;
+Lisp_Object Qrisky_local_variable;
/* If non-zero, emacs should not attempt to use a window-specific code,
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. */
-EMACS_INT emacs_priority;
-
/* If non-zero, a filter or a sentinel is running. Tested to save the match
data on the first attempt to change it inside asynchronous code. */
int running_asynch_code;
int noninteractive;
-/* Value of Lisp variable `noninteractive'.
- Normally same as C variable `noninteractive'
- but nothing terrible happens if user sets this one. */
-
-int noninteractive1;
-
-/* Nonzero means Emacs was run in --quick mode. */
-int inhibit_x_resources;
+/* Nonzero means remove site-lisp directories from load-path. */
+int no_site_lisp;
/* Name for the server started by the daemon.*/
static char *daemon_name;
--no-init-file, -q load neither ~/.emacs nor default.el\n\
--no-shared-memory, -nl do not use shared memory\n\
--no-site-file do not load site-start.el\n\
+--no-site-lisp, -nsl do not add site-lisp directories to load-path\n\
--no-splash do not display a splash screen on startup\n\
--no-window-system, -nw do not communicate with X, ignoring $DISPLAY\n\
---quick, -Q equivalent to -q --no-site-file --no-splash\n\
+--quick, -Q equivalent to:\n\
+ -q --no-site-file --no-site-lisp --no-splash\n\
--script FILE run FILE as an Emacs Lisp script\n\
--terminal, -t DEVICE use DEVICE for terminal I/O\n\
--user, -u USER load ~USER/.emacs instead of your own\n\
}
else
{
- version = SDATA (tem);
- copyright = SDATA (tem2);
+ version = SSDATA (tem);
+ copyright = SSDATA (tem2);
}
}
else
emacs_close (0);
emacs_close (1);
result = emacs_open (term, O_RDWR, 0);
- if (result < 0)
+ if (result < 0 || dup (0) < 0)
{
char *errstring = strerror (errno);
fprintf (stderr, "%s: %s: %s\n", argv[0], term, errstring);
exit (1);
}
- dup (0);
if (! isatty (0))
{
fprintf (stderr, "%s: %s: not a tty\n", argv[0], term);
no_loadup
= argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);
+ no_site_lisp
+ = argmatch (argv, argc, "-nsl", "--no-site-lisp", 11, NULL, &skip_args);
+
#ifdef HAVE_NS
ns_alloc_autorelease_pool();
if (!noninteractive)
&& argv[count_before + 1][1] == '-')
argv[count_before + 1] = "-d";
+ if (! no_site_lisp)
+ {
+ if (argmatch (argv, argc, "-Q", "--quick", 3, NULL, &skip_args)
+ || argmatch (argv, argc, "-quick", 0, 2, NULL, &skip_args))
+ no_site_lisp = 1;
+ }
+
/* Don't actually discard this arg. */
skip_args = count_before;
}
+#else /* !HAVE_X_WINDOWS */
+ if (! no_site_lisp)
+ {
+ int count_before = skip_args;
+
+ if (argmatch (argv, argc, "-Q", "--quick", 3, NULL, &skip_args)
+ || argmatch (argv, argc, "-quick", 0, 2, NULL, &skip_args))
+ no_site_lisp = 1;
+
+ skip_args = count_before;
+ }
#endif
/* argmatch must not be used after here,
{ "-daemon", "--daemon", 99, 0 },
{ "-help", "--help", 90, 0 },
{ "-nl", "--no-loadup", 70, 0 },
+ { "-nsl", "--no-site-lisp", 65, 0 },
/* -d must come last before the options handled in startup.el. */
{ "-d", "--display", 60, 1 },
{ "-display", 0, 60, 1 },
/* Now for the options handled in `command-line' (startup.el). */
+ /* (Note that to imply -nsl, -Q is partially handled here.) */
{ "-Q", "--quick", 55, 0 },
{ "-quick", 0, 55, 0 },
{ "-q", "--no-init-file", 50, 0 },
kill it because we are exiting Emacs deliberately (not crashing).
Do it after shut_down_emacs, which does an auto-save. */
if (STRINGP (Vauto_save_list_file_name))
- unlink (SDATA (Vauto_save_list_file_name));
+ unlink (SSDATA (Vauto_save_list_file_name));
exit (INTEGERP (arg) ? XINT (arg) : EXIT_SUCCESS);
}
#ifdef USE_MMAP_FOR_BUFFERS
mmap_set_vars (0);
#endif
- unexec (SDATA (filename), !NILP (symfile) ? SDATA (symfile) : 0);
+ unexec (SSDATA (filename), !NILP (symfile) ? SSDATA (symfile) : 0);
#ifdef USE_MMAP_FOR_BUFFERS
mmap_set_vars (1);
#endif
{
*plocale = desired_locale;
setlocale (category, (STRINGP (desired_locale)
- ? (char *) SDATA (desired_locale)
+ ? SSDATA (desired_locale)
: ""));
}
}
{
Qfile_name_handler_alist = intern_c_string ("file-name-handler-alist");
staticpro (&Qfile_name_handler_alist);
+ Qrisky_local_variable = intern_c_string ("risky-local-variable");
+ staticpro (&Qrisky_local_variable);
#ifndef CANNOT_DUMP
defsubr (&Sdump_emacs);
defsubr (&Sdaemonp);
defsubr (&Sdaemon_initialized);
- DEFVAR_LISP ("command-line-args", &Vcommand_line_args,
+ DEFVAR_LISP ("command-line-args", Vcommand_line_args,
doc: /* Args passed by shell to Emacs, as a list of strings.
Many arguments are deleted from the list as they are processed. */);
- DEFVAR_LISP ("system-type", &Vsystem_type,
+ DEFVAR_LISP ("system-type", Vsystem_type,
doc: /* The value is a symbol indicating the type of operating system you are using.
Special values:
`gnu' compiled for a GNU Hurd system.
Vsystem_type = intern_c_string (SYSTEM_TYPE);
/* Above values are from SYSTEM_TYPE in src/s/*.h. */
- DEFVAR_LISP ("system-configuration", &Vsystem_configuration,
+ DEFVAR_LISP ("system-configuration", Vsystem_configuration,
doc: /* Value is string indicating configuration Emacs was built for.
On MS-Windows, the value reflects the OS flavor and version on which
Emacs is running. */);
Vsystem_configuration = build_string (EMACS_CONFIGURATION);
- DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options,
+ DEFVAR_LISP ("system-configuration-options", Vsystem_configuration_options,
doc: /* String containing the configuration options Emacs was built with. */);
Vsystem_configuration_options = build_string (EMACS_CONFIG_OPTIONS);
- DEFVAR_BOOL ("noninteractive", &noninteractive1,
+ DEFVAR_BOOL ("noninteractive", noninteractive1,
doc: /* Non-nil means Emacs is running without interactive terminal. */);
- DEFVAR_LISP ("kill-emacs-hook", &Vkill_emacs_hook,
+ DEFVAR_LISP ("kill-emacs-hook", Vkill_emacs_hook,
doc: /* Hook to be run when `kill-emacs' is called.
Since `kill-emacs' may be invoked when the terminal is disconnected (or
in other similar situations), functions placed on this hook should not
`noninteractive' was non-nil. */);
Vkill_emacs_hook = Qnil;
- DEFVAR_INT ("emacs-priority", &emacs_priority,
- doc: /* Priority for Emacs to run at.
-This value is effective only if set before Emacs is dumped,
-and only if the Emacs executable is installed with setuid to permit
-it to change priority. (Emacs sets its uid back to the real uid.)
-Currently, you need to define SET_EMACS_PRIORITY in `config.h'
-before you compile Emacs, to enable the code for this feature. */);
- emacs_priority = 0;
-
- DEFVAR_LISP ("path-separator", &Vpath_separator,
+ DEFVAR_LISP ("path-separator", Vpath_separator,
doc: /* String containing the character that separates directories in
search paths, such as PATH and other similar environment variables. */);
{
Vpath_separator = make_string (&c, 1);
}
- DEFVAR_LISP ("invocation-name", &Vinvocation_name,
+ DEFVAR_LISP ("invocation-name", Vinvocation_name,
doc: /* The program name that was used to run Emacs.
Any directory names are omitted. */);
- DEFVAR_LISP ("invocation-directory", &Vinvocation_directory,
+ DEFVAR_LISP ("invocation-directory", Vinvocation_directory,
doc: /* The directory in which the Emacs executable was found, to run it.
The value is nil if that directory's name is not known. */);
- DEFVAR_LISP ("installation-directory", &Vinstallation_directory,
+ DEFVAR_LISP ("installation-directory", Vinstallation_directory,
doc: /* A directory within which to look for the `lib-src' and `etc' directories.
This is non-nil when we can't find those directories in their standard
installed locations, but we can find them near where the Emacs executable
was found. */);
Vinstallation_directory = Qnil;
- DEFVAR_LISP ("system-messages-locale", &Vsystem_messages_locale,
+ DEFVAR_LISP ("system-messages-locale", Vsystem_messages_locale,
doc: /* System locale for messages. */);
Vsystem_messages_locale = Qnil;
DEFVAR_LISP ("previous-system-messages-locale",
- &Vprevious_system_messages_locale,
+ Vprevious_system_messages_locale,
doc: /* Most recently used system locale for messages. */);
Vprevious_system_messages_locale = Qnil;
- DEFVAR_LISP ("system-time-locale", &Vsystem_time_locale,
+ DEFVAR_LISP ("system-time-locale", Vsystem_time_locale,
doc: /* System locale for time. */);
Vsystem_time_locale = Qnil;
- DEFVAR_LISP ("previous-system-time-locale", &Vprevious_system_time_locale,
+ DEFVAR_LISP ("previous-system-time-locale", Vprevious_system_time_locale,
doc: /* Most recently used system locale for time. */);
Vprevious_system_time_locale = Qnil;
- DEFVAR_LISP ("before-init-time", &Vbefore_init_time,
+ DEFVAR_LISP ("before-init-time", Vbefore_init_time,
doc: /* Value of `current-time' before Emacs begins initialization. */);
Vbefore_init_time = Qnil;
- DEFVAR_LISP ("after-init-time", &Vafter_init_time,
+ DEFVAR_LISP ("after-init-time", Vafter_init_time,
doc: /* Value of `current-time' after loading the init files.
This is nil during initialization. */);
Vafter_init_time = Qnil;
- DEFVAR_BOOL ("inhibit-x-resources", &inhibit_x_resources,
+ DEFVAR_BOOL ("inhibit-x-resources", inhibit_x_resources,
doc: /* If non-nil, X resources, Windows Registry settings, and NS defaults are not used. */);
inhibit_x_resources = 0;
- DEFVAR_LISP ("emacs-copyright", &Vemacs_copyright,
+ DEFVAR_LISP ("emacs-copyright", Vemacs_copyright,
doc: /* Short copyright string for this version of Emacs. */);
Vemacs_copyright = build_string (emacs_copyright);
- DEFVAR_LISP ("emacs-version", &Vemacs_version,
+ DEFVAR_LISP ("emacs-version", Vemacs_version,
doc: /* Version numbers of this version of Emacs. */);
Vemacs_version = build_string (emacs_version);
- DEFVAR_LISP ("dynamic-library-alist", &Vdynamic_library_alist,
+ DEFVAR_LISP ("dynamic-library-alist", Vdynamic_library_alist,
doc: /* Alist of dynamic libraries vs external files implementing them.
Each element is a list (LIBRARY FILE...), where the car is a symbol
representing a supported external library, and the rest are strings giving
/* Make sure IS_DAEMON starts up as false. */
daemon_pipe[1] = 0;
}
-