/* Synchronous subprocess invocation for GNU Emacs.
Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <stdio.h>
#include <setjmp.h>
#include <sys/types.h>
-
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif
#include <sys/file.h>
#include <fcntl.h>
#endif
#endif
-Lisp_Object Vexec_path, Vexec_directory, Vexec_suffixes;
-Lisp_Object Vdata_directory, Vdoc_directory;
-Lisp_Object Vconfigure_info_directory, Vshared_game_score_directory;
-
/* Pattern used by call-process-region to make temp files. */
static Lisp_Object Vtemp_file_name_pattern;
-Lisp_Object Vshell_file_name;
-
-Lisp_Object Vprocess_environment, Vinitial_environment;
-
#ifdef DOS_NT
Lisp_Object Qbuffer_file_type;
#endif /* DOS_NT */
#ifdef WINDOWSNT
prepare_standard_handles (in, out, err, handles);
set_process_dir (SDATA (current_dir));
+ /* Spawn the child. (See ntproc.c:Spawnve). */
+ cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
+ reset_standard_handles (in, out, err, handles);
+ if (cpid == -1)
+ /* An error occurred while trying to spawn the process. */
+ report_file_error ("Spawning child process", Qnil);
+ return cpid;
+
#else /* not WINDOWSNT */
/* Make sure that in, out, and err are not actually already in
descriptors zero, one, or two; this could happen if Emacs is
emacs_close (out);
if (err != in && err != out)
emacs_close (err);
-#endif /* not MSDOS */
-#endif /* not WINDOWSNT */
#if defined(USG)
#ifndef SETPGRP_RELEASES_CTTY
setpgrp (); /* No arguments but equivalent in this case */
#endif
-#else
+#else /* not USG */
setpgrp (pid, pid);
-#endif /* USG */
+#endif /* not USG */
-#ifdef MSDOS
- pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env);
- xfree (pwd_var);
- if (pid == -1)
- /* An error occurred while trying to run the subprocess. */
- report_file_error ("Spawning child process", Qnil);
- return pid;
-#else /* not MSDOS */
-#ifdef WINDOWSNT
- /* Spawn the child. (See ntproc.c:Spawnve). */
- cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
- reset_standard_handles (in, out, err, handles);
- if (cpid == -1)
- /* An error occurred while trying to spawn the process. */
- report_file_error ("Spawning child process", Qnil);
- return cpid;
-#else /* not WINDOWSNT */
/* setpgrp_of_tty is incorrect here; it uses input_fd. */
- EMACS_SET_TTY_PGRP (0, &pid);
+ tcsetpgrp (0, pid);
/* execvp does not accept an environment arg so the only way
to pass this environment is to set environ. Our caller
emacs_write (1, new_argv[0], strlen (new_argv[0]));
emacs_write (1, "\n", 1);
_exit (1);
-#endif /* not WINDOWSNT */
-#endif /* not MSDOS */
+
+#else /* MSDOS */
+ pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env);
+ xfree (pwd_var);
+ if (pid == -1)
+ /* An error occurred while trying to run the subprocess. */
+ report_file_error ("Spawning child process", Qnil);
+ return pid;
+#endif /* MSDOS */
+#endif /* not WINDOWSNT */
}
#ifndef WINDOWSNT
{
if (SBYTES (entry) > varlen && SREF (entry, varlen) == '=')
{
- *value = (char *) SDATA (entry) + (varlen + 1);
+ *value = SSDATA (entry) + (varlen + 1);
*valuelen = SBYTES (entry) - (varlen + 1);
return 1;
}
= Fframe_parameter (NILP (frame) ? selected_frame : frame, Qdisplay);
if (STRINGP (display))
{
- *value = (char *) SDATA (display);
+ *value = SSDATA (display);
*valuelen = SBYTES (display);
return 1;
}
syms_of_callproc (void)
{
#ifdef DOS_NT
- Qbuffer_file_type = intern ("buffer-file-type");
+ Qbuffer_file_type = intern_c_string ("buffer-file-type");
staticpro (&Qbuffer_file_type);
#endif /* DOS_NT */
#endif
staticpro (&Vtemp_file_name_pattern);
- DEFVAR_LISP ("shell-file-name", &Vshell_file_name,
+ DEFVAR_LISP ("shell-file-name", Vshell_file_name,
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,
+ DEFVAR_LISP ("exec-path", Vexec_path,
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,
+ DEFVAR_LISP ("exec-suffixes", Vexec_suffixes,
doc: /* *List of suffixes to try to find executable file names.
Each element is a string. */);
Vexec_suffixes = Qnil;
- DEFVAR_LISP ("exec-directory", &Vexec_directory,
+ DEFVAR_LISP ("exec-directory", Vexec_directory,
doc: /* Directory for executables for Emacs to invoke.
More generally, this includes any architecture-dependent files
that are built and installed from the Emacs distribution. */);
- DEFVAR_LISP ("data-directory", &Vdata_directory,
+ DEFVAR_LISP ("data-directory", Vdata_directory,
doc: /* Directory of machine-independent files that come with GNU Emacs.
These are files intended for Emacs to use while it runs. */);
- DEFVAR_LISP ("doc-directory", &Vdoc_directory,
+ DEFVAR_LISP ("doc-directory", Vdoc_directory,
doc: /* Directory containing the DOC file that comes with GNU Emacs.
This is usually the same as `data-directory'. */);
- DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory,
+ DEFVAR_LISP ("configure-info-directory", Vconfigure_info_directory,
doc: /* For internal use by the build procedure only.
This is the name of the directory in which the build procedure installed
Emacs's info files; the default value for `Info-default-directory-list'
includes this. */);
Vconfigure_info_directory = build_string (PATH_INFO);
- DEFVAR_LISP ("shared-game-score-directory", &Vshared_game_score_directory,
+ DEFVAR_LISP ("shared-game-score-directory", Vshared_game_score_directory,
doc: /* Directory of score files for games which come with GNU Emacs.
If this variable is nil, then Emacs is unable to use a shared directory. */);
#ifdef DOS_NT
Vshared_game_score_directory = build_string (PATH_GAME);
#endif
- DEFVAR_LISP ("initial-environment", &Vinitial_environment,
+ DEFVAR_LISP ("initial-environment", Vinitial_environment,
doc: /* List of environment variables inherited from the parent process.
Each element should be a string of the form ENVVARNAME=VALUE.
The elements must normally be decoded (using `locale-coding-system') for use. */);
Vinitial_environment = Qnil;
- DEFVAR_LISP ("process-environment", &Vprocess_environment,
+ DEFVAR_LISP ("process-environment", Vprocess_environment,
doc: /* List of overridden environment variables for subprocesses to inherit.
Each element should be a string of the form ENVVARNAME=VALUE.
defsubr (&Sgetenv_internal);
defsubr (&Scall_process_region);
}
-
-/* arch-tag: 769b8045-1df7-4d2b-8968-e3fb49017f95
- (do not change this comment) */