Reimplement execvp() such that it can invoke shell scripts.

We conveniently reuse mingw_execve(), which does the shbang interpretation
as well as other painful Windows compatibility stuff.
This commit is contained in:
Johannes Sixt
2007-11-02 21:38:57 +01:00
parent 36e0147fe5
commit 2952476e8e
2 changed files with 16 additions and 0 deletions

View File

@@ -529,6 +529,20 @@ void mingw_free_path_split(char **path)
free(path);
}
void mingw_execvp(const char *cmd, const char **argv)
{
char **path = mingw_get_path_split();
char *prog = mingw_path_lookup(cmd, path);
if (prog) {
mingw_execve(prog, argv, (const char **) environ);
free(prog);
} else
errno = ENOENT;
mingw_free_path_split(path);
}
int mingw_socket(int domain, int type, int protocol)
{
SOCKET s = WSASocket(domain, type, protocol, NULL, 0, 0);

View File

@@ -430,6 +430,8 @@ unsigned int alarm(unsigned int seconds);
#include <winsock2.h>
void mingw_execve(const char *cmd, const char **argv, const char **env);
#define execve mingw_execve
extern void mingw_execvp(const char *cmd, const char **argv);
#define execvp mingw_execvp
int fork();
typedef int pid_t;
#define waitpid(pid, status, options) \