diff options
author | Li Jin <dragon-fly@qq.com> | 2023-08-24 09:21:38 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-08-24 09:21:38 +0800 |
commit | cfcea12ba0e6a40d7c04ac64c75563db0896985c (patch) | |
tree | 8ee7c6d9cd5f7b60fd9bda035b703cc9969ab678 /src/3rdParty/lua/loslib.c | |
parent | eb48c686a7ab5bd3f3f3a8628ed0423872a932c6 (diff) | |
download | yuescript-cfcea12ba0e6a40d7c04ac64c75563db0896985c.tar.gz yuescript-cfcea12ba0e6a40d7c04ac64c75563db0896985c.tar.bz2 yuescript-cfcea12ba0e6a40d7c04ac64c75563db0896985c.zip |
update Lua 5.4.
Diffstat (limited to 'src/3rdParty/lua/loslib.c')
-rw-r--r-- | src/3rdParty/lua/loslib.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/3rdParty/lua/loslib.c b/src/3rdParty/lua/loslib.c index 854dcf6..ad5a927 100644 --- a/src/3rdParty/lua/loslib.c +++ b/src/3rdParty/lua/loslib.c | |||
@@ -30,23 +30,14 @@ | |||
30 | */ | 30 | */ |
31 | #if !defined(LUA_STRFTIMEOPTIONS) /* { */ | 31 | #if !defined(LUA_STRFTIMEOPTIONS) /* { */ |
32 | 32 | ||
33 | /* options for ANSI C 89 (only 1-char options) */ | ||
34 | #define L_STRFTIMEC89 "aAbBcdHIjmMpSUwWxXyYZ%" | ||
35 | |||
36 | /* options for ISO C 99 and POSIX */ | ||
37 | #define L_STRFTIMEC99 "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" \ | ||
38 | "||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy" /* two-char options */ | ||
39 | |||
40 | /* options for Windows */ | ||
41 | #define L_STRFTIMEWIN "aAbBcdHIjmMpSUwWxXyYzZ%" \ | ||
42 | "||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y" /* two-char options */ | ||
43 | |||
44 | #if defined(LUA_USE_WINDOWS) | 33 | #if defined(LUA_USE_WINDOWS) |
45 | #define LUA_STRFTIMEOPTIONS L_STRFTIMEWIN | 34 | #define LUA_STRFTIMEOPTIONS "aAbBcdHIjmMpSUwWxXyYzZ%" \ |
46 | #elif defined(LUA_USE_C89) | 35 | "||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y" /* two-char options */ |
47 | #define LUA_STRFTIMEOPTIONS L_STRFTIMEC89 | 36 | #elif defined(LUA_USE_C89) /* ANSI C 89 (only 1-char options) */ |
37 | #define LUA_STRFTIMEOPTIONS "aAbBcdHIjmMpSUwWxXyYZ%" | ||
48 | #else /* C99 specification */ | 38 | #else /* C99 specification */ |
49 | #define LUA_STRFTIMEOPTIONS L_STRFTIMEC99 | 39 | #define LUA_STRFTIMEOPTIONS "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" \ |
40 | "||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy" /* two-char options */ | ||
50 | #endif | 41 | #endif |
51 | 42 | ||
52 | #endif /* } */ | 43 | #endif /* } */ |
@@ -138,12 +129,21 @@ | |||
138 | /* }================================================================== */ | 129 | /* }================================================================== */ |
139 | 130 | ||
140 | 131 | ||
132 | #if !defined(l_system) | ||
133 | #if defined(LUA_USE_IOS) | ||
134 | /* Despite claiming to be ISO C, iOS does not implement 'system'. */ | ||
135 | #define l_system(cmd) ((cmd) == NULL ? 0 : -1) | ||
136 | #else | ||
137 | #define l_system(cmd) system(cmd) /* default definition */ | ||
138 | #endif | ||
139 | #endif | ||
140 | |||
141 | 141 | ||
142 | static int os_execute (lua_State *L) { | 142 | static int os_execute (lua_State *L) { |
143 | const char *cmd = luaL_optstring(L, 1, NULL); | 143 | const char *cmd = luaL_optstring(L, 1, NULL); |
144 | int stat; | 144 | int stat; |
145 | errno = 0; | 145 | errno = 0; |
146 | stat = system(cmd); | 146 | stat = l_system(cmd); |
147 | if (cmd != NULL) | 147 | if (cmd != NULL) |
148 | return luaL_execresult(L, stat); | 148 | return luaL_execresult(L, stat); |
149 | else { | 149 | else { |