}
#endif
+#ifdef RUN_TIME_REMAP
+ if (initialized)
+ run_time_remap (argv[0]);
+#endif
+
sort_args (argc, argv);
if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args))
else
{
printf ("GNU Emacs %s\n", XSTRING (tem)->data);
- printf ("Copyright (C) 1996 Free Software Foundation, Inc.\n");
+ printf ("Copyright (C) 1997 Free Software Foundation, Inc.\n");
printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n");
printf ("You may redistribute copies of Emacs\n");
printf ("under the terms of the GNU General Public License.\n");
#endif /* VMS */
#if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK)
- /* Extend the stack space available. */
- if (!getrlimit (RLIMIT_STACK, &rlim))
+ /* Extend the stack space available.
+ Don't do that if dumping, since some systems (e.g. DJGPP)
+ might define a smaller stack limit at that time. */
+ if (1
+#ifndef CANNOT_DUMP
+ && (!noninteractive || initialized)
+#endif
+ && !getrlimit (RLIMIT_STACK, &rlim))
{
long newlim;
+ extern int re_max_failures;
/* Approximate the amount regex.c needs, plus some more. */
- newlim = 800000 * sizeof (char *);
+ newlim = re_max_failures * 2 * 20 * sizeof (char *);
#ifdef __NetBSD__
/* NetBSD (at least NetBSD 1.2G and former) has a bug in its
stack allocation routine for new process that the allocation
newlim = (newlim + getpagesize () - 1) / getpagesize () * getpagesize();
#endif
if (newlim > rlim.rlim_max)
- newlim = rlim.rlim_max;
+ {
+ newlim = rlim.rlim_max;
+ /* Don't let regex.c overflow the stack. */
+ re_max_failures = newlim / (2 * 20 * sizeof (char *));
+ }
if (rlim.rlim_cur < newlim)
rlim.rlim_cur = newlim;
/* Record (approximately) where the stack begins. */
stack_bottom = &stack_bottom_variable;
-#ifdef RUN_TIME_REMAP
- if (initialized)
- run_time_remap (argv[0]);
-#endif
-
#ifdef USG_SHARED_LIBRARIES
if (bss_end)
brk ((void *)bss_end);
#endif
}
+ /* Gerd Moellmann <gerd@acm.org> says this makes profiling work on
+ FreeBSD. It might work on some other systems too.
+ Give it a try and tell me if it works on your system. */
+#ifdef __FreeBSD__
+#ifdef PROFILING
+ if (initialized)
+ {
+ extern void _mcleanup ();
+ extern char etext;
+ extern Lisp_Object Fredraw_frame ();
+ atexit (_mcleanup);
+ /* This uses Fredraw_frame because that function
+ comes first in the Emacs executable.
+ It might be better to use something that gives
+ the start of the text segment, but start_of_text
+ is not defined on all systems now. */
+ monstartup (Fredraw_frame, &etext);
+ }
+ else
+ moncontrol (0);
+#endif
+#endif
+
initialized = 1;
#ifdef LOCALTIME_CACHE