diff options
author | Hans Hagen <pragma@wxs.nl> | 2023-01-26 19:34:21 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2023-01-26 19:34:21 +0100 |
commit | 83667a906d7cac842635bc5243db70f55b346562 (patch) | |
tree | 6d22734798c775c081c3aecb7f05faf590e6570b /source/luametatex/source/luacore/lua54/src/loslib.c | |
parent | b47e8c2cdeeab0bcdb1c4c32328c933f3f8599de (diff) | |
download | context-83667a906d7cac842635bc5243db70f55b346562.tar.gz |
2023-01-26 18:34:00
Diffstat (limited to 'source/luametatex/source/luacore/lua54/src/loslib.c')
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/loslib.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/luametatex/source/luacore/lua54/src/loslib.c b/source/luametatex/source/luacore/lua54/src/loslib.c index 854dcf691..7eb05cafd 100644 --- a/source/luametatex/source/luacore/lua54/src/loslib.c +++ b/source/luametatex/source/luacore/lua54/src/loslib.c @@ -138,12 +138,28 @@ /* }================================================================== */ +/* +** Despite claiming to be ISO, the C library in some Apple platforms +** does not implement 'system'. +*/ +#if !defined(l_system) && defined(__APPLE__) /* { */ +#include "TargetConditionals.h" +#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV +#define l_system(cmd) ((cmd) == NULL ? 0 : -1) +#endif +#endif /* } */ + +#if !defined(l_system) +#define l_system(cmd) system(cmd) /* default definition */ +#endif + + static int os_execute (lua_State *L) { const char *cmd = luaL_optstring(L, 1, NULL); int stat; errno = 0; - stat = system(cmd); + stat = l_system(cmd); if (cmd != NULL) return luaL_execresult(L, stat); else { |