Mercurial > hg > xemacs-beta
comparison src/emacs.c @ 233:52952cbfc5b5 r20-5b15
Import from CVS: tag r20-5b15
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:14:14 +0200 |
parents | 557eaa0339bf |
children | 85a06df23a9a |
comparison
equal
deleted
inserted
replaced
232:aa6545ea0638 | 233:52952cbfc5b5 |
---|---|
458 | 458 |
459 /* Make stack traces always identify version + configuration */ | 459 /* Make stack traces always identify version + configuration */ |
460 #define main_1 STACK_TRACE_EYE_CATCHER | 460 #define main_1 STACK_TRACE_EYE_CATCHER |
461 | 461 |
462 static DOESNT_RETURN | 462 static DOESNT_RETURN |
463 main_1 (int argc, char **argv, char **envp) | 463 main_1 (int argc, char **argv, char **envp, int restart) |
464 { | 464 { |
465 char stack_bottom_variable; | 465 char stack_bottom_variable; |
466 int skip_args = 0; | 466 int skip_args = 0; |
467 Lisp_Object load_me; | 467 Lisp_Object load_me; |
468 int inhibit_window_system; | 468 int inhibit_window_system; |
1436 init_gif_err (); | 1436 init_gif_err (); |
1437 #endif | 1437 #endif |
1438 init_console_stream (); /* Create the first console */ | 1438 init_console_stream (); /* Create the first console */ |
1439 | 1439 |
1440 /* try to get the actual pathname of the exec file we are running */ | 1440 /* try to get the actual pathname of the exec file we are running */ |
1441 if (!restart) | |
1441 { | 1442 { |
1442 Vinvocation_name = Fcar (Vcommand_line_args); | 1443 Vinvocation_name = Fcar (Vcommand_line_args); |
1444 if (XSTRING_DATA(Vinvocation_name)[0] == '-') | |
1445 { | |
1446 /* XEmacs as a login shell, oh goody! */ | |
1447 Vinvocation_name = build_string(getenv("SHELL")); | |
1448 } | |
1443 Vinvocation_directory = Vinvocation_name; | 1449 Vinvocation_directory = Vinvocation_name; |
1444 | 1450 |
1445 if (!NILP (Ffile_name_directory (Vinvocation_name))) | 1451 if (!NILP (Ffile_name_directory (Vinvocation_name))) |
1446 /* invocation-name includes a directory component -- presumably it | 1452 /* invocation-name includes a directory component -- presumably it |
1447 is relative to cwd, not $PATH */ | 1453 is relative to cwd, not $PATH */ |
1794 main (int argc, char **argv, char **envp) | 1800 main (int argc, char **argv, char **envp) |
1795 { | 1801 { |
1796 int volatile vol_argc = argc; | 1802 int volatile vol_argc = argc; |
1797 char ** volatile vol_argv = argv; | 1803 char ** volatile vol_argv = argv; |
1798 char ** volatile vol_envp = envp; | 1804 char ** volatile vol_envp = envp; |
1805 /* This is hairy. We need to compute where the XEmacs binary was invoked */ | |
1806 /* from because temacs initialization requires it to find the lisp */ | |
1807 /* directories. The code that recomputes the path is guarded by the */ | |
1808 /* restarted flag. There are three possible paths I've found so far */ | |
1809 /* through this: */ | |
1810 /* temacs -- When running temacs for basic build stuff, the first main_1 */ | |
1811 /* will be the only one invoked. It must compute the path else there */ | |
1812 /* will be a very ugly bomb in startup.el (can't find obvious location */ | |
1813 /* for doc-directory data-directory, etc.). */ | |
1814 /* temacs w/ run-temacs on the command line -- This is run to bytecompile */ | |
1815 /* all the out of date dumped lisp. It will execute both of the main_1 */ | |
1816 /* calls and the second one must not touch the first computation because */ | |
1817 /* argc/argv are hosed the second time through. */ | |
1818 /* xemacs -- Only the second main_1 is executed. The invocation path must */ | |
1819 /* computed but this only matters when running in place or when running */ | |
1820 /* as a login shell. */ | |
1821 /* As a bonus for straightening this out, XEmacs can now be run in place */ | |
1822 /* as a login shell. This never used to work. */ | |
1823 /* As another bonus, we can now guarantee that */ | |
1824 /* (concat invocation-directory invocation-name) contains the filename */ | |
1825 /* of the XEmacs binary we are running. This can now be used in a */ | |
1826 /* definite test for out of date dumped files. -slb */ | |
1827 int restarted = 0; | |
1799 #ifdef QUANTIFY | 1828 #ifdef QUANTIFY |
1800 quantify_stop_recording_data (); | 1829 quantify_stop_recording_data (); |
1801 quantify_clear_data (); | 1830 quantify_clear_data (); |
1802 #endif /* QUANTIFY */ | 1831 #endif /* QUANTIFY */ |
1803 | 1832 |
1809 | 1838 |
1810 if (!initialized) | 1839 if (!initialized) |
1811 { | 1840 { |
1812 run_temacs_argc = 0; | 1841 run_temacs_argc = 0; |
1813 if (! SETJMP (run_temacs_catch)) | 1842 if (! SETJMP (run_temacs_catch)) |
1814 main_1 (vol_argc, vol_argv, vol_envp); | 1843 { |
1844 main_1 (vol_argc, vol_argv, vol_envp, 0); | |
1845 } | |
1815 /* run-emacs-from-temacs called */ | 1846 /* run-emacs-from-temacs called */ |
1847 restarted = 1; | |
1816 vol_argc = run_temacs_argc; | 1848 vol_argc = run_temacs_argc; |
1817 vol_argv = run_temacs_argv; | 1849 vol_argv = run_temacs_argv; |
1818 #ifdef _SCO_DS | 1850 #ifdef _SCO_DS |
1819 /* This makes absolutely no sense to anyone involved. There are | 1851 /* This makes absolutely no sense to anyone involved. There are |
1820 several people using this stuff. We've compared versions on | 1852 several people using this stuff. We've compared versions on |
1837 #endif /* _SCO_DS */ | 1869 #endif /* _SCO_DS */ |
1838 vol_envp = environ; | 1870 vol_envp = environ; |
1839 } | 1871 } |
1840 run_temacs_argc = -1; | 1872 run_temacs_argc = -1; |
1841 | 1873 |
1842 main_1 (vol_argc, vol_argv, vol_envp); | 1874 main_1 (vol_argc, vol_argv, vol_envp, restarted); |
1843 return 0; /* unreached */ | 1875 return 0; /* unreached */ |
1844 } | 1876 } |
1845 | 1877 |
1846 | 1878 |
1847 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /* | 1879 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /* |