diff options
| author | Joakim Verona | 2012-07-27 02:22:03 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-07-27 02:22:03 +0200 |
| commit | 5fb63197843dcae66f2fe0ddd6f4a9d560e9db2f (patch) | |
| tree | 5c55f1096a656a9759f0b53a0b5d1a2289bd366f /src/callproc.c | |
| parent | 0c5c85cf2b350c965bb1ffa5b2d77c2adebc406b (diff) | |
| parent | 562157c814037dcba58a20cd6908a95992c22283 (diff) | |
| download | emacs-5fb63197843dcae66f2fe0ddd6f4a9d560e9db2f.tar.gz emacs-5fb63197843dcae66f2fe0ddd6f4a9d560e9db2f.zip | |
upstream
Diffstat (limited to 'src/callproc.c')
| -rw-r--r-- | src/callproc.c | 59 |
1 files changed, 49 insertions, 10 deletions
diff --git a/src/callproc.c b/src/callproc.c index 804af1e9abb..facca887772 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -61,6 +61,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 61 | #include "msdos.h" | 61 | #include "msdos.h" |
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | #ifdef HAVE_NS | ||
| 65 | #include "nsterm.h" | ||
| 66 | #endif | ||
| 67 | |||
| 64 | #ifndef USE_CRT_DLL | 68 | #ifndef USE_CRT_DLL |
| 65 | extern char **environ; | 69 | extern char **environ; |
| 66 | #endif | 70 | #endif |
| @@ -97,8 +101,6 @@ int synch_process_retcode; | |||
| 97 | /* Nonzero if this is termination due to exit. */ | 101 | /* Nonzero if this is termination due to exit. */ |
| 98 | static int call_process_exited; | 102 | static int call_process_exited; |
| 99 | 103 | ||
| 100 | static Lisp_Object Fgetenv_internal (Lisp_Object, Lisp_Object); | ||
| 101 | |||
| 102 | static Lisp_Object | 104 | static Lisp_Object |
| 103 | call_process_kill (Lisp_Object fdpid) | 105 | call_process_kill (Lisp_Object fdpid) |
| 104 | { | 106 | { |
| @@ -1174,9 +1176,9 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1174 | /* MSDOS must have all environment variables malloc'ed, because | 1176 | /* MSDOS must have all environment variables malloc'ed, because |
| 1175 | low-level libc functions that launch subsidiary processes rely | 1177 | low-level libc functions that launch subsidiary processes rely |
| 1176 | on that. */ | 1178 | on that. */ |
| 1177 | pwd_var = (char *) xmalloc (i + 6); | 1179 | pwd_var = xmalloc (i + 6); |
| 1178 | #else | 1180 | #else |
| 1179 | pwd_var = (char *) alloca (i + 6); | 1181 | pwd_var = alloca (i + 6); |
| 1180 | #endif | 1182 | #endif |
| 1181 | temp = pwd_var + 4; | 1183 | temp = pwd_var + 4; |
| 1182 | memcpy (pwd_var, "PWD=", 4); | 1184 | memcpy (pwd_var, "PWD=", 4); |
| @@ -1244,7 +1246,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1244 | } | 1246 | } |
| 1245 | 1247 | ||
| 1246 | /* new_length + 2 to include PWD and terminating 0. */ | 1248 | /* new_length + 2 to include PWD and terminating 0. */ |
| 1247 | env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *)); | 1249 | env = new_env = alloca ((new_length + 2) * sizeof *env); |
| 1248 | /* If we have a PWD envvar, pass one down, | 1250 | /* If we have a PWD envvar, pass one down, |
| 1249 | but with corrected value. */ | 1251 | but with corrected value. */ |
| 1250 | if (egetenv ("PWD")) | 1252 | if (egetenv ("PWD")) |
| @@ -1252,7 +1254,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1252 | 1254 | ||
| 1253 | if (STRINGP (display)) | 1255 | if (STRINGP (display)) |
| 1254 | { | 1256 | { |
| 1255 | char *vdata = (char *) alloca (sizeof "DISPLAY=" + SBYTES (display)); | 1257 | char *vdata = alloca (sizeof "DISPLAY=" + SBYTES (display)); |
| 1256 | strcpy (vdata, "DISPLAY="); | 1258 | strcpy (vdata, "DISPLAY="); |
| 1257 | strcat (vdata, SSDATA (display)); | 1259 | strcat (vdata, SSDATA (display)); |
| 1258 | new_env = add_env (env, new_env, vdata); | 1260 | new_env = add_env (env, new_env, vdata); |
| @@ -1515,18 +1517,37 @@ init_callproc_1 (void) | |||
| 1515 | { | 1517 | { |
| 1516 | char *data_dir = egetenv ("EMACSDATA"); | 1518 | char *data_dir = egetenv ("EMACSDATA"); |
| 1517 | char *doc_dir = egetenv ("EMACSDOC"); | 1519 | char *doc_dir = egetenv ("EMACSDOC"); |
| 1520 | #ifdef HAVE_NS | ||
| 1521 | const char *etc_dir = ns_etc_directory (); | ||
| 1522 | const char *path_exec = ns_exec_path (); | ||
| 1523 | #endif | ||
| 1518 | 1524 | ||
| 1519 | Vdata_directory | 1525 | Vdata_directory |
| 1520 | = Ffile_name_as_directory (build_string (data_dir ? data_dir | 1526 | = Ffile_name_as_directory (build_string (data_dir ? data_dir |
| 1521 | : PATH_DATA)); | 1527 | #ifdef HAVE_NS |
| 1528 | : (etc_dir ? etc_dir : PATH_DATA) | ||
| 1529 | #else | ||
| 1530 | : PATH_DATA | ||
| 1531 | #endif | ||
| 1532 | )); | ||
| 1522 | Vdoc_directory | 1533 | Vdoc_directory |
| 1523 | = Ffile_name_as_directory (build_string (doc_dir ? doc_dir | 1534 | = Ffile_name_as_directory (build_string (doc_dir ? doc_dir |
| 1524 | : PATH_DOC)); | 1535 | #ifdef HAVE_NS |
| 1536 | : (etc_dir ? etc_dir : PATH_DOC) | ||
| 1537 | #else | ||
| 1538 | : PATH_DOC | ||
| 1539 | #endif | ||
| 1540 | )); | ||
| 1525 | 1541 | ||
| 1526 | /* Check the EMACSPATH environment variable, defaulting to the | 1542 | /* Check the EMACSPATH environment variable, defaulting to the |
| 1527 | PATH_EXEC path from epaths.h. */ | 1543 | PATH_EXEC path from epaths.h. */ |
| 1528 | Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC); | 1544 | Vexec_path = decode_env_path ("EMACSPATH", |
| 1545 | #ifdef HAVE_NS | ||
| 1546 | path_exec ? path_exec : | ||
| 1547 | #endif | ||
| 1548 | PATH_EXEC); | ||
| 1529 | Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path)); | 1549 | Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path)); |
| 1550 | /* FIXME? For ns, path_exec should go at the front? */ | ||
| 1530 | Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path); | 1551 | Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path); |
| 1531 | } | 1552 | } |
| 1532 | 1553 | ||
| @@ -1539,6 +1560,17 @@ init_callproc (void) | |||
| 1539 | 1560 | ||
| 1540 | register char * sh; | 1561 | register char * sh; |
| 1541 | Lisp_Object tempdir; | 1562 | Lisp_Object tempdir; |
| 1563 | #ifdef HAVE_NS | ||
| 1564 | if (data_dir == 0) | ||
| 1565 | { | ||
| 1566 | const char *etc_dir = ns_etc_directory (); | ||
| 1567 | if (etc_dir) | ||
| 1568 | { | ||
| 1569 | data_dir = alloca (strlen (etc_dir) + 1); | ||
| 1570 | strcpy (data_dir, etc_dir); | ||
| 1571 | } | ||
| 1572 | } | ||
| 1573 | #endif | ||
| 1542 | 1574 | ||
| 1543 | if (!NILP (Vinstallation_directory)) | 1575 | if (!NILP (Vinstallation_directory)) |
| 1544 | { | 1576 | { |
| @@ -1550,7 +1582,14 @@ init_callproc (void) | |||
| 1550 | /* MSDOS uses wrapped binaries, so don't do this. */ | 1582 | /* MSDOS uses wrapped binaries, so don't do this. */ |
| 1551 | if (NILP (Fmember (tem, Vexec_path))) | 1583 | if (NILP (Fmember (tem, Vexec_path))) |
| 1552 | { | 1584 | { |
| 1553 | Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC); | 1585 | #ifdef HAVE_NS |
| 1586 | const char *path_exec = ns_exec_path (); | ||
| 1587 | #endif | ||
| 1588 | Vexec_path = decode_env_path ("EMACSPATH", | ||
| 1589 | #ifdef HAVE_NS | ||
| 1590 | path_exec ? path_exec : | ||
| 1591 | #endif | ||
| 1592 | PATH_EXEC); | ||
| 1554 | Vexec_path = Fcons (tem, Vexec_path); | 1593 | Vexec_path = Fcons (tem, Vexec_path); |
| 1555 | Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path); | 1594 | Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path); |
| 1556 | } | 1595 | } |