From 81a1b4eac326da03bd92c9c04944faf822e43a3a Mon Sep 17 00:00:00 2001 From: Felipe Magno de Almeida Date: Tue, 15 Dec 2020 15:43:55 -0300 Subject: [PATCH] evil: Add execvp based on UCRT's _execvp --- src/lib/evil/evil_unistd.c | 7 +++++++ src/lib/evil/evil_unistd.h | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/lib/evil/evil_unistd.c b/src/lib/evil/evil_unistd.c index 5c02c69e91..5c065bee9a 100644 --- a/src/lib/evil/evil_unistd.c +++ b/src/lib/evil/evil_unistd.c @@ -14,6 +14,13 @@ #include "evil_private.h" +#ifdef _MSC_VER +EVIL_API int +execvp(const char *file, char *const argv[]) +{ + return _execvp(file, (const char *const *)argv); +} +#endif LONGLONG _evil_time_freq; LONGLONG _evil_time_count; diff --git a/src/lib/evil/evil_unistd.h b/src/lib/evil/evil_unistd.h index 9d3e0de048..9f7b324af9 100644 --- a/src/lib/evil/evil_unistd.h +++ b/src/lib/evil/evil_unistd.h @@ -18,6 +18,17 @@ #include // for read, write, access, close +#define execvp _ucrt_execvp // overriding execvp below +#include // for _execvp (but not execvp), getpid +#undef execvp +EVIL_API int execvp(const char *file, char *const argv[]); + +/* Values for the second argument to access. These may be OR'd together. */ +#define R_OK 4 /* Test for read permission. */ +#define W_OK 2 /* Test for write permission. */ +#define X_OK 0 /* execute permission, originally '1', just a bypass here*/ +#define F_OK 0 /* Test for existence. */ + #endif // _MSC_VER /*