change exec and spawn to _exec and _spawn

svn path=/trunk/; revision=262
This commit is contained in:
Boudewijn Dekker 1999-02-21 13:43:05 +00:00
parent 87028edf14
commit eef71ffb98
17 changed files with 48 additions and 64 deletions

View file

@ -1,7 +1,7 @@
#include <process.h>
#include <windows.h>
int system(const char *command)
int _system(const char *command)
{
char CmdLine[MAX_PATH];
char *comspec = getenv("COMSPEC");
@ -13,4 +13,4 @@ int system(const char *command)
return -1;
return 0;
}
}

View file

@ -4,7 +4,7 @@
extern char *const *_environ;
int execl(const char *path, const char *argv0, ...)
int _execl(const char *path, const char *argv0, ...)
{
return spawnve(P_OVERLAY, path, (char *const*)&argv0, _environ);
return _spawnve(P_OVERLAY, path, (const char *const*)&argv0,(const char *const*) _environ);
}

View file

@ -10,8 +10,8 @@
u.ccp = *++ptr; \
ptr = u.ccpp;
int execle(const char *path, const char *argv0, ... /*, const char **envp */)
int _execle(const char *path, const char *argv0, ... /*, const char **envp */)
{
scan_ptr();
return spawnve(P_OVERLAY, path, (char *const *)&argv0, (char *const *)ptr);
return _spawnve(P_OVERLAY, path, (const char *const *)&argv0, (const char *const *)ptr);
}

View file

@ -3,9 +3,9 @@
#include <process.h>
extern char * const *_environ;
extern char **_environ;
int execlp(const char *path, const char *argv0, ...)
int _execlp(const char *path, const char *argv0, ...)
{
return spawnvpe(P_OVERLAY, path, (char * const *)&argv0, _environ);
return _spawnvpe(P_OVERLAY, path, (const char * const *)&argv0,(const char *const*) _environ);
}

View file

@ -10,8 +10,8 @@
u.ccp = *++ptr; \
ptr = u.ccpp;
int execlpe(const char *path, const char *argv0, ... /*, const char **envp */)
int _execlpe(const char *path, const char *argv0, ... /*, const char **envp */)
{
scan_ptr();
return spawnvpe(P_OVERLAY, path, (char * const *)&argv0, (char * const *)ptr);
return _spawnvpe(P_OVERLAY, path, (const char * const *)&argv0, (const char * const *)ptr);
}

View file

@ -1,11 +1,10 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
//#include <libc/stubs.h>
//#include <unistd.h>
#include <process.h>
extern char * const *_environ;
int execv(const char *path, const char * const *argv)
int _execv(const char *path, const char * const *argv)
{
return spawnve(P_OVERLAY, path, argv, _environ);
return _spawnve(P_OVERLAY, path, argv,(const char *const*) _environ);
}

View file

@ -1,9 +1,8 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
//#include <libc/stubs.h>
//#include <unistd.h>
#include <process.h>
int execve(const char *path,const char * const argv[], char * const envp[])
int _execve(const char *path,const char * const argv[], char * const envp[])
{
return spawnve(P_OVERLAY, path, argv, envp);
return _spawnve(P_OVERLAY, path, argv, envp);
}

View file

@ -1,11 +1,9 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
//#include <libc/stubs.h>
//#include <unistd.h>
#include <process.h>
extern char *const *_environ;
int execvp(const char *path,const char * const argv[])
int _execvp(const char *path,const char * const argv[])
{
return spawnvpe(P_OVERLAY, path, argv, _environ);
return _spawnvpe(P_OVERLAY,path,(const char *const*) argv,(const char *const*) _environ);
}

View file

@ -3,13 +3,10 @@
#include <process.h>
int execvpe(const char *path,const char * const argv[],const char * const envp[])
int _execvpe(const char *path,const char * const argv[],const char * const envp[])
{
return spawnvpe(P_OVERLAY, path, argv, envp);
return _spawnvpe(P_OVERLAY, path, argv, envp);
}
int _execvpe(const char *path,const char * const argv[],const char * const envp[])
{
return spawnvpe(P_OVERLAY, path, argv, envp);
}

View file

@ -2,9 +2,9 @@
#include <process.h>
extern char **_environ;
extern char *_environ[];
int spawnl(int mode, const char *path, const char *argv0, ...)
int _spawnl(int mode, const char *path, const char *argv0, ...)
{
return spawnve(mode, path, (char * const *)&argv0, _environ);
return _spawnve(mode, path, (const char * const *)&argv0,(const char *const *) _environ);
}

View file

@ -9,8 +9,8 @@
u.ccp = *++ptr; \
ptr = u.ccpp;
int spawnle(int mode, const char *path, const char *argv0, ... /*, const char **envp */)
int _spawnle(int mode, const char *path, const char *argv0, ... /*, const char **envp */)
{
scan_ptr();
return spawnve(mode, path, (char * const *)&argv0, (char * const *)ptr);
return _spawnve(mode, path, (const char * const *)&argv0, (const char * const *)ptr);
}

View file

@ -4,7 +4,7 @@
extern char **_environ;
int spawnlp(int mode, const char *path, const char *argv0, ...)
int _spawnlp(int mode, const char *path, const char *argv0, ...)
{
return spawnvpe(mode, path, (char * const *)&argv0, (char * const *)_environ);
return _spawnvpe(mode, path, (const char * const *)&argv0, (const char * const *)_environ);
}

View file

@ -11,5 +11,5 @@
int spawnlpe(int mode, const char *path, const char *argv0, ... /*, const char **envp */)
{
scan_ptr();
return spawnvpe(mode, path, (char * const *)&argv0, (char * const *)ptr);
return spawnvpe(mode, path, (const char * const *)&argv0, (const char * const *)ptr);
}

View file

@ -2,9 +2,9 @@
#include <process.h>
extern char **_environ;
extern char *_environ[];
int spawnv(int mode, const char *path,const char *const argv[])
int _spawnv(int mode, const char *path,const char *const argv[])
{
return spawnve(mode, path, (char * const *)argv, _environ);
return _spawnve(mode, path, (const char * const *)argv,(const char * const *) _environ);
}

View file

@ -1,11 +1,12 @@
#include <windows.h>
#include <process.h>
#include <string.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
int _p_overlay = 2;
int spawnve(int mode, const char *path,const char *const argv[],const char *const envp[])
int _spawnve(int mode, const char *path,const char *const argv[],const char *const envp[])
{
char ApplicationName[MAX_PATH];
@ -28,15 +29,15 @@ int spawnve(int mode, const char *path,const char *const argv[],const char *cons
StartupInfo.dwFlags = 0;
// if ( CreateProcessA(ApplicationName,CommandLine,NULL,NULL,TRUE,CREATE_NEW_CONSOLE|NORMAL_PRIORITY_CLASS,NULL,*envp,&StartupInfo,&ProcessInformation) ) {
// errno = GetLastError();
// return -1;
// }
if ( CreateProcessA(ApplicationName,CommandLine,NULL,NULL,TRUE,CREATE_NEW_CONSOLE|NORMAL_PRIORITY_CLASS,NULL,*envp,&StartupInfo,&ProcessInformation) ) {
//errno = GetLastError();
return -1;
}
if (mode == P_OVERLAY)
exit(i);
// _P_NOWAIT or _P_NOWAITO
return ProcessInformation.hProcess;
return (int)ProcessInformation.hProcess;
}

View file

@ -2,9 +2,9 @@
#include <process.h>
extern char **_environ;
extern char *_environ[];
int spawnvp(int mode, const char *path,const char *const argv[])
int _spawnvp(int mode, const char *path,const char *const argv[])
{
return spawnvpe(mode, path, (char * const *)argv, _environ);
return _spawnvpe(mode, path, (const char * const *)argv,(const char * const *) _environ);
}

View file

@ -4,20 +4,10 @@
#include <errno.h>
int spawnvpe(int mode, const char *path,const char *const argv[],const char *const envp[])
int _spawnvpe(int mode, const char *path,const char *const argv[],const char *const envp[])
{
char rpath[300];
union {const char * const *cpcp; char **cpp; } u;
u.cpcp = envp;
/*
if (!__dosexec_find_on_path(path, u.cpp, rpath))
{
errno = ENOENT;
return -1;
}
else
*/
return spawnve(mode, rpath, argv, envp);
// djgpp does something like a searchpath here
return _spawnve(mode, path, argv, envp);
}