/* 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
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "msdos.h"
#endif
-#ifdef VMS
-extern noshare char **environ;
-#else
#ifndef USE_CRT_DLL
extern char **environ;
#endif
-#endif
#ifdef HAVE_SETPGID
#if !defined (USG) || defined (BSD_PGRPS)
EXFUN (Fgetenv_internal, 2);
-#ifndef VMS /* VMS version is in vmsproc.c. */
-
static Lisp_Object
call_process_kill (fdpid)
Lisp_Object fdpid;
int bufsize = CALLPROC_BUFFER_SIZE_MIN;
int count = SPECPDL_INDEX ();
- register const unsigned char **new_argv
- = (const unsigned char **) alloca ((max (2, nargs - 2)) * sizeof (char *));
+ register const unsigned char **new_argv;
struct buffer *old = current_buffer;
/* File to use for stderr in the child.
t means use same as standard output. */
#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
char *outf, *tempfile;
int outfilefd;
-#endif
-#if 0
- int mask;
#endif
struct coding_system process_coding; /* coding-system of process output */
struct coding_system argument_coding; /* coding-system of arguments */
a sensible default. */
current_dir = build_string ("~/");
current_dir = expand_and_dir_to_file (current_dir, Qnil);
+ current_dir = Ffile_name_as_directory (current_dir);
+
if (NILP (Ffile_accessible_directory_p (current_dir)))
report_file_error ("Setting current directory",
Fcons (current_buffer->directory, Qnil));
&& SREF (path, 1) == ':')
path = Fsubstring (path, make_number (2), Qnil);
- new_argv[0] = SDATA (path);
+ new_argv = (const unsigned char **)
+ alloca (max (2, nargs - 2) * sizeof (char *));
if (nargs > 4)
{
register int i;
if (CODING_REQUIRE_ENCODING (&argument_coding))
/* We must encode this argument. */
args[i] = encode_coding_string (&argument_coding, args[i], 1);
- new_argv[i - 3] = SDATA (args[i]);
}
UNGCPRO;
- new_argv[nargs - 3] = 0;
+ for (i = 4; i < nargs; i++)
+ new_argv[i - 3] = SDATA (args[i]);
+ new_argv[i - 3] = 0;
}
else
new_argv[1] = 0;
+ new_argv[0] = SDATA (path);
#ifdef MSDOS /* MW, July 1993 */
if ((outf = egetenv ("TMPDIR")))
emacs_close (filefd);
report_file_error ("Creating process pipe", Qnil);
}
-#endif
-#if 0
- /* Replaced by close_process_descs */
- set_exclusive_use (fd[0]);
#endif
}
Vlocale_coding_system, 0);
return make_number (synch_process_retcode);
}
-#endif
\f
static Lisp_Object
delete_temp_file (name)
RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs, args)));
}
\f
-#ifndef VMS /* VMS version is in vmsproc.c. */
-
static int relocate_fd ();
static char **
VARIABLE should be a string. Value is nil if VARIABLE is undefined in
the environment. Otherwise, value is a string.
-This function searches `process-environment' for VARIABLE. If it is
-not found there, then it continues the search in the environment list
-of the selected frame.
+This function searches `process-environment' for VARIABLE.
If optional parameter ENV is a list, then search this list instead of
-`process-environment', and return t when encountering a negative entry.
-
-If it is a frame, then this function will ignore `process-environment' and
-will simply look up the variable in that frame's environment. */)
+`process-environment', and return t when encountering a negative entry
+\(an entry for a variable with no value). */)
(variable, env)
Lisp_Object variable, env;
{
return 0;
}
-#endif /* not VMS */
\f
/* This is run before init_cmdargs. */
dir_warning ("Warning: arch-independent data dir (%s) does not exist.\n",
Vdata_directory);
-#ifdef VMS
- Vshell_file_name = build_string ("*dcl*");
-#else
sh = (char *) getenv ("SHELL");
Vshell_file_name = build_string (sh ? sh : "/bin/sh");
-#endif
-#ifdef VMS
- Vtemp_file_name_pattern = build_string ("tmp:emacsXXXXXX.");
-#else
if (getenv ("TMPDIR"))
{
char *dir = getenv ("TMPDIR");
}
else
Vtemp_file_name_pattern = build_string ("/tmp/emacsXXXXXX");
-#endif
#ifdef DOS_NT
Vshared_game_score_directory = Qnil;
See `setenv' and `getenv'. */);
Vprocess_environment = Qnil;
-#ifndef VMS
defsubr (&Scall_process);
defsubr (&Sgetenv_internal);
-#endif
defsubr (&Scall_process_region);
}