diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 5729933d58b..0b084c8c5ec 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -211,14 +211,14 @@ debug_channels (msvcrt) @ cdecl _errno() MSVCRT__errno @ cdecl _except_handler2(ptr ptr ptr ptr) _except_handler2 @ 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 _execlp #(str str) varargs +@ varargs _execlp(str str) _execlp @ stub _execlpe #(str str) varargs -@ stub _execv #(str str) -@ stub _execve #(str str str) -@ stub _execvp #(str str) -@ stub _execvpe #(str str str) +@ cdecl _execv(str str) _execv +@ cdecl _execve(str str str) _execve +@ cdecl _execvp(str str) _execvp +@ cdecl _execvpe(str str str) _execvpe @ cdecl _exit(long) MSVCRT__exit @ cdecl _expand(ptr long) _expand @ cdecl _fcloseall() _fcloseall diff --git a/dlls/msvcrt/process.c b/dlls/msvcrt/process.c index 4f946a2c3a3..c8441d32fee 100644 --- a/dlls/msvcrt/process.c +++ b/dlls/msvcrt/process.c @@ -181,6 +181,83 @@ int _cwait(int *status, int pid, int action) 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.@) */ @@ -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, ...) { @@ -216,7 +293,7 @@ int _spawnlp(int flags, const char* name, const char* arg0, ...) args = msvcrt_valisttos(arg0, ap, ' '); va_end(ap); - ret = msvcrt_spawn(flags, name, args, NULL); + ret = msvcrt_spawn(flags, fullname[0] ? fullname : name, args, NULL); MSVCRT_free(args); return ret;