/* Synchronous subprocess invocation for GNU Emacs.
- Copyright (C) 1985-1988, 1993-1995, 1999-2011
+ Copyright (C) 1985-1988, 1993-1995, 1999-2012
Free Software Foundation, Inc.
This file is part of GNU Emacs.
#endif /* MSDOS */
#include "commands.h"
-#include "buffer.h"
#include "character.h"
+#include "buffer.h"
#include "ccl.h"
#include "coding.h"
#include "composite.h"
#include "msdos.h"
#endif
+#ifdef HAVE_NS
+#include "nsterm.h"
+#endif
+
#ifndef USE_CRT_DLL
extern char **environ;
#endif
/* Nonzero if this is termination due to exit. */
static int call_process_exited;
-static Lisp_Object Fgetenv_internal (Lisp_Object, Lisp_Object);
-
static Lisp_Object
call_process_kill (Lisp_Object fdpid)
{
The program's input comes from file INFILE (nil means `/dev/null').
Insert output in BUFFER before point; t means current buffer; nil for BUFFER
means discard it; 0 means discard and don't wait; and `(:file FILE)', where
- FILE is a file name string, means that it should be written to that file.
+ FILE is a file name string, means that it should be written to that file
+ \(if the file already exists it is overwritten).
BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
REAL-BUFFER says what to do with standard output, as above,
while STDERR-FILE says what to do with standard error in the child.
/* GConf causes us to ignore SIGPIPE, make sure it is restored
in the child. */
- //signal (SIGPIPE, SIG_DFL);
+ signal (SIGPIPE, SIG_DFL);
#ifdef HAVE_WORKING_VFORK
pthread_sigmask (SIG_SETMASK, &procmask, 0);
#endif
/* If BUFFER is nil, we must read process output once and then
discard it, so setup coding system but with nil. */
setup_coding_system (Qnil, &process_coding);
+ process_coding.dst_multibyte = 0;
}
else
{
&& !NILP (val))
val = raw_text_coding_system (val);
setup_coding_system (val, &process_coding);
+ process_coding.dst_multibyte
+ = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
}
+ process_coding.src_multibyte = 0;
immediate_quit = 1;
QUIT;
Insert output in BUFFER before point; t means current buffer; nil for
BUFFER means discard it; 0 means discard and don't wait; and `(:file
FILE)', where FILE is a file name string, means that it should be
- written to that file.
+ written to that file (if the file already exists it is overwritten).
BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
REAL-BUFFER says what to do with standard output, as above,
while STDERR-FILE says what to do with standard error in the child.
UNBLOCK_INPUT;
if (fd == -1)
report_file_error ("Failed to open temporary file",
- Fcons (Vtemp_file_name_pattern, Qnil));
+ Fcons (build_string (tempfile), Qnil));
else
close (fd);
}
/* MSDOS must have all environment variables malloc'ed, because
low-level libc functions that launch subsidiary processes rely
on that. */
- pwd_var = (char *) xmalloc (i + 6);
+ pwd_var = xmalloc (i + 6);
#else
- pwd_var = (char *) alloca (i + 6);
+ pwd_var = alloca (i + 6);
#endif
temp = pwd_var + 4;
memcpy (pwd_var, "PWD=", 4);
}
/* new_length + 2 to include PWD and terminating 0. */
- env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *));
+ env = new_env = alloca ((new_length + 2) * sizeof *env);
/* If we have a PWD envvar, pass one down,
but with corrected value. */
if (egetenv ("PWD"))
if (STRINGP (display))
{
- char *vdata = (char *) alloca (sizeof "DISPLAY=" + SBYTES (display));
+ char *vdata = alloca (sizeof "DISPLAY=" + SBYTES (display));
strcpy (vdata, "DISPLAY=");
strcat (vdata, SSDATA (display));
new_env = add_env (env, new_env, vdata);
{
char *data_dir = egetenv ("EMACSDATA");
char *doc_dir = egetenv ("EMACSDOC");
+#ifdef HAVE_NS
+ const char *etc_dir = ns_etc_directory ();
+ const char *path_exec = ns_exec_path ();
+#endif
Vdata_directory
= Ffile_name_as_directory (build_string (data_dir ? data_dir
- : PATH_DATA));
+#ifdef HAVE_NS
+ : (etc_dir ? etc_dir : PATH_DATA)
+#else
+ : PATH_DATA
+#endif
+ ));
Vdoc_directory
= Ffile_name_as_directory (build_string (doc_dir ? doc_dir
- : PATH_DOC));
+#ifdef HAVE_NS
+ : (etc_dir ? etc_dir : PATH_DOC)
+#else
+ : PATH_DOC
+#endif
+ ));
/* Check the EMACSPATH environment variable, defaulting to the
PATH_EXEC path from epaths.h. */
- Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC);
+ Vexec_path = decode_env_path ("EMACSPATH",
+#ifdef HAVE_NS
+ path_exec ? path_exec :
+#endif
+ PATH_EXEC);
Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
+ /* FIXME? For ns, path_exec should go at the front? */
Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
}
register char * sh;
Lisp_Object tempdir;
+#ifdef HAVE_NS
+ if (data_dir == 0)
+ {
+ const char *etc_dir = ns_etc_directory ();
+ if (etc_dir)
+ {
+ data_dir = alloca (strlen (etc_dir) + 1);
+ strcpy (data_dir, etc_dir);
+ }
+ }
+#endif
if (!NILP (Vinstallation_directory))
{
/* MSDOS uses wrapped binaries, so don't do this. */
if (NILP (Fmember (tem, Vexec_path)))
{
- Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC);
+#ifdef HAVE_NS
+ const char *path_exec = ns_exec_path ();
+#endif
+ Vexec_path = decode_env_path ("EMACSPATH",
+#ifdef HAVE_NS
+ path_exec ? path_exec :
+#endif
+ PATH_EXEC);
Vexec_path = Fcons (tem, Vexec_path);
Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
}
staticpro (&Vtemp_file_name_pattern);
DEFVAR_LISP ("shell-file-name", Vshell_file_name,
- doc: /* *File name to load inferior shells from.
+ doc: /* File name to load inferior shells from.
Initialized from the SHELL environment variable, or to a system-dependent
default if SHELL is not set. */);
DEFVAR_LISP ("exec-path", Vexec_path,
- doc: /* *List of directories to search programs to run in subprocesses.
+ doc: /* List of directories to search programs to run in subprocesses.
Each element is a string (directory name) or nil (try default directory). */);
DEFVAR_LISP ("exec-suffixes", Vexec_suffixes,
- doc: /* *List of suffixes to try to find executable file names.
+ doc: /* List of suffixes to try to find executable file names.
Each element is a string. */);
Vexec_suffixes = Qnil;