1995-08-09 08:06:35 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Objective Caml */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* Automatique. Distributed only by permission. */
|
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
1995-05-08 08:18:32 -07:00
|
|
|
#include <mlvalues.h>
|
|
|
|
#include <memory.h>
|
1996-09-04 07:15:31 -07:00
|
|
|
#include "unixsupport.h"
|
1995-05-08 08:18:32 -07:00
|
|
|
|
|
|
|
extern char ** cstringvect();
|
1996-09-04 07:15:31 -07:00
|
|
|
extern char ** environ;
|
1995-05-08 08:18:32 -07:00
|
|
|
|
|
|
|
value unix_execvp(path, args) /* ML */
|
|
|
|
value path, args;
|
|
|
|
{
|
|
|
|
char ** argv;
|
|
|
|
argv = cstringvect(args);
|
|
|
|
(void) execvp(String_val(path), argv);
|
|
|
|
stat_free((char *) argv);
|
|
|
|
uerror("execvp", path);
|
|
|
|
return Val_unit; /* never reached, but suppress warnings */
|
|
|
|
/* from smart compilers */
|
|
|
|
}
|
|
|
|
|
1996-09-04 07:15:31 -07:00
|
|
|
value unix_execvpe(path, args, env) /* ML */
|
|
|
|
value path, args, env;
|
|
|
|
{
|
|
|
|
char ** argv;
|
|
|
|
char ** saved_environ;
|
|
|
|
argv = cstringvect(args);
|
|
|
|
saved_environ = environ;
|
|
|
|
environ = cstringvect(env);
|
|
|
|
(void) execvp(String_val(path), argv);
|
|
|
|
stat_free((char *) argv);
|
|
|
|
stat_free((char *) environ);
|
|
|
|
environ = saved_environ;
|
|
|
|
uerror("execvp", path);
|
|
|
|
return Val_unit; /* never reached, but suppress warnings */
|
|
|
|
/* from smart compilers */
|
|
|
|
}
|
|
|
|
|