Fixed spawnlp and added exec variants.

This commit is contained in:
Mike Bond 2001-05-22 19:18:51 +00:00 committed by Alexandre Julliard
parent 99abdec378
commit a286cd3074
2 changed files with 85 additions and 8 deletions

View File

@ -211,14 +211,14 @@ debug_channels (msvcrt)
@ cdecl _errno() MSVCRT__errno @ cdecl _errno() MSVCRT__errno
@ cdecl _except_handler2(ptr ptr ptr ptr) _except_handler2 @ cdecl _except_handler2(ptr ptr ptr ptr) _except_handler2
@ cdecl _except_handler3(ptr ptr ptr ptr) _except_handler3 @ cdecl _except_handler3(ptr ptr ptr ptr) _except_handler3
@ stub _execl #(str str) varargs @ varargs _execl(str str) _execl
@ stub _execle #(str str) varargs @ stub _execle #(str str) varargs
@ stub _execlp #(str str) varargs @ varargs _execlp(str str) _execlp
@ stub _execlpe #(str str) varargs @ stub _execlpe #(str str) varargs
@ stub _execv #(str str) @ cdecl _execv(str str) _execv
@ stub _execve #(str str str) @ cdecl _execve(str str str) _execve
@ stub _execvp #(str str) @ cdecl _execvp(str str) _execvp
@ stub _execvpe #(str str str) @ cdecl _execvpe(str str str) _execvpe
@ cdecl _exit(long) MSVCRT__exit @ cdecl _exit(long) MSVCRT__exit
@ cdecl _expand(ptr long) _expand @ cdecl _expand(ptr long) _expand
@ cdecl _fcloseall() _fcloseall @ cdecl _fcloseall() _fcloseall

View File

@ -181,6 +181,83 @@ int _cwait(int *status, int pid, int action)
return status ? *status = -1 : -1; return status ? *status = -1 : -1;
} }
/*********************************************************************
* _execl (MSVCRT.@)
*/
int _execl(const char* name, const char* arg0, ...)
{
va_list ap;
char * args;
int ret;
va_start(ap, arg0);
args = msvcrt_valisttos(arg0, ap, ' ');
va_end(ap);
ret = msvcrt_spawn(_P_OVERLAY, name, args, NULL);
MSVCRT_free(args);
return ret;
}
/*********************************************************************
* _execlp (MSVCRT.@)
*/
int _execlp(const char* name, const char* arg0, ...)
{
va_list ap;
char * args;
int ret;
char fullname[MAX_PATH];
_searchenv(name, "PATH", fullname);
va_start(ap, arg0);
args = msvcrt_valisttos(arg0, ap, ' ');
va_end(ap);
ret = msvcrt_spawn(_P_OVERLAY, fullname[0] ? fullname : name, args, NULL);
MSVCRT_free(args);
return ret;
}
/*********************************************************************
* _execv (MSVCRT.@)
*/
int _execv(const char* name, char* const* argv)
{
return _spawnve(_P_OVERLAY, name, (const char* const*) argv, NULL);
}
/*********************************************************************
* _execve (MSVCRT.@)
*/
int _execve(const char* name, char* const* argv, const char* const* envv)
{
return _spawnve(_P_OVERLAY, name, (const char* const*) argv, envv);
}
/*********************************************************************
* _execvpe (MSVCRT.@)
*/
int _execvpe(const char* name, char* const* argv, const char* const* envv)
{
char fullname[MAX_PATH];
_searchenv(name, "PATH", fullname);
return _spawnve(_P_OVERLAY, fullname[0] ? fullname : name,
(const char* const*) argv, envv);
}
/*********************************************************************
* _execvp (MSVCRT.@)
*/
int _execvp(const char* name, char* const* argv)
{
return _execvpe(name, argv, NULL);
}
/********************************************************************* /*********************************************************************
* _spawnl (MSVCRT.@) * _spawnl (MSVCRT.@)
*/ */
@ -201,7 +278,7 @@ int _spawnl(int flags, const char* name, const char* arg0, ...)
} }
/********************************************************************* /*********************************************************************
* _spawnl (MSVCRT.@) * _spawnlp (MSVCRT.@)
*/ */
int _spawnlp(int flags, const char* name, const char* arg0, ...) int _spawnlp(int flags, const char* name, const char* arg0, ...)
{ {
@ -216,7 +293,7 @@ int _spawnlp(int flags, const char* name, const char* arg0, ...)
args = msvcrt_valisttos(arg0, ap, ' '); args = msvcrt_valisttos(arg0, ap, ' ');
va_end(ap); va_end(ap);
ret = msvcrt_spawn(flags, name, args, NULL); ret = msvcrt_spawn(flags, fullname[0] ? fullname : name, args, NULL);
MSVCRT_free(args); MSVCRT_free(args);
return ret; return ret;