aboutsummaryrefslogtreecommitdiff
path: root/loslib.c
diff options
context:
space:
mode:
Diffstat (limited to 'loslib.c')
-rw-r--r--loslib.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/loslib.c b/loslib.c
index 854dcf69..89ac06bc 100644
--- a/loslib.c
+++ b/loslib.c
@@ -138,12 +138,21 @@
138/* }================================================================== */ 138/* }================================================================== */
139 139
140 140
141#if !defined(l_system)
142#if defined(LUA_USE_IOS)
143/* Despite claiming to be ISO C, iOS does not implement 'system'. */
144#define l_system(cmd) ((cmd) == NULL ? 0 : -1)
145#else
146#define l_system(cmd) system(cmd) /* default definition */
147#endif
148#endif
149
141 150
142static int os_execute (lua_State *L) { 151static int os_execute (lua_State *L) {
143 const char *cmd = luaL_optstring(L, 1, NULL); 152 const char *cmd = luaL_optstring(L, 1, NULL);
144 int stat; 153 int stat;
145 errno = 0; 154 errno = 0;
146 stat = system(cmd); 155 stat = l_system(cmd);
147 if (cmd != NULL) 156 if (cmd != NULL)
148 return luaL_execresult(L, stat); 157 return luaL_execresult(L, stat);
149 else { 158 else {