Add shell_execute.

This commit is contained in:
Learath Lea 2014-12-31 16:07:44 +02:00
parent cf418160b6
commit 8d7251be4a
2 changed files with 13 additions and 0 deletions

View file

@ -56,6 +56,7 @@
#include <direct.h>
#include <errno.h>
#include <process.h>
#include <shellapi.h>
#else
#error NOT IMPLEMENTED
#endif
@ -2343,6 +2344,16 @@ int pid()
#endif
}
void shell_execute(const char *file, const char *argv)
{
#if defined(CONF_FAMILY_WINDOWS)
ShellExecute(NULL, NULL, file, NULL, NULL, SW_SHOWDEFAULT);
#elif defined(CONF_FAMILY_UNIX)
pid_t pid = fork();
if(!pid)
execv(file, argv);
#endif
}
#if defined(__cplusplus)
}

View file

@ -1326,6 +1326,8 @@ int str_utf8_check(const char *str);
int pid();
void shell_execute(const char *file, const char *argv);
#ifdef __cplusplus
}
#endif