mirror of
https://github.com/albertodemichelis/squirrel.git
synced 2026-01-12 06:28:43 +01:00
@ -19,6 +19,10 @@
|
||||
#define scremove remove
|
||||
#define screname rename
|
||||
#endif
|
||||
#ifdef IOS
|
||||
#include <spawn.h>
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
static SQInteger _system_getenv(HSQUIRRELVM v)
|
||||
{
|
||||
@ -30,18 +34,22 @@ static SQInteger _system_getenv(HSQUIRRELVM v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static SQInteger _system_system(HSQUIRRELVM v)
|
||||
{
|
||||
const SQChar *s;
|
||||
if(SQ_SUCCEEDED(sq_getstring(v,2,&s))){
|
||||
sq_pushinteger(v,scsystem(s));
|
||||
#ifdef IOS
|
||||
pid_t pid;
|
||||
posix_spawn(&pid, s, NULL, NULL, NULL, environ);
|
||||
sq_pushinteger(v, 0);
|
||||
#else
|
||||
sq_pushinteger(v,scsystem(s));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
return sq_throwerror(v,_SC("wrong param"));
|
||||
}
|
||||
|
||||
|
||||
static SQInteger _system_clock(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushfloat(v,((SQFloat)clock())/(SQFloat)CLOCKS_PER_SEC);
|
||||
|
||||
Reference in New Issue
Block a user