diff options
| -rw-r--r-- | liolib.c | 29 | ||||
| -rw-r--r-- | loslib.c | 21 | ||||
| -rw-r--r-- | luaconf.h | 42 |
3 files changed, 48 insertions, 44 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: liolib.c,v 2.82 2009/09/01 19:10:48 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.83 2009/11/24 12:05:44 roberto Exp roberto $ |
| 3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -19,6 +19,33 @@ | |||
| 19 | #include "lualib.h" | 19 | #include "lualib.h" |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | /* | ||
| 23 | ** lua_popen spawns a new process connected to the current one through | ||
| 24 | ** the file streams. | ||
| 25 | */ | ||
| 26 | #if !defined(lua_popen) | ||
| 27 | |||
| 28 | #if defined(LUA_USE_POPEN) | ||
| 29 | |||
| 30 | #define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) | ||
| 31 | #define lua_pclose(L,file) ((void)L, pclose(file)) | ||
| 32 | |||
| 33 | #elif defined(LUA_WIN) | ||
| 34 | |||
| 35 | #define lua_popen(L,c,m) ((void)L, _popen(c,m)) | ||
| 36 | #define lua_pclose(L,file) ((void)L, _pclose(file)) | ||
| 37 | |||
| 38 | #else | ||
| 39 | |||
| 40 | #define lua_popen(L,c,m) ((void)((void)c, m), \ | ||
| 41 | luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) | ||
| 42 | #define lua_pclose(L,file) ((void)((void)L, file), -1) | ||
| 43 | |||
| 44 | #endif | ||
| 45 | |||
| 46 | #endif | ||
| 47 | |||
| 48 | |||
| 22 | 49 | ||
| 23 | #define IO_INPUT 1 | 50 | #define IO_INPUT 1 |
| 24 | #define IO_OUTPUT 2 | 51 | #define IO_OUTPUT 2 |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loslib.c,v 1.27 2009/11/24 12:05:44 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.28 2009/12/17 12:26:09 roberto Exp roberto $ |
| 3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -21,6 +21,23 @@ | |||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | /* | 23 | /* |
| 24 | ** list of valid conversion specifiers @* for the 'strftime' function | ||
| 25 | */ | ||
| 26 | #if !defined(LUA_STRFTIMEOPTIONS) | ||
| 27 | |||
| 28 | #if !defined(LUA_USE_POSIX) | ||
| 29 | #define LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" } | ||
| 30 | #else | ||
| 31 | #define LUA_STRFTIMEOPTIONS { "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%", "", \ | ||
| 32 | "E", "cCxXyY", \ | ||
| 33 | "O", "deHImMSuUVwWy" } | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #endif | ||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | /* | ||
| 24 | ** By default, Lua uses tmpnam except when POSIX is available, where it | 41 | ** By default, Lua uses tmpnam except when POSIX is available, where it |
| 25 | ** uses mkstemp. | 42 | ** uses mkstemp. |
| 26 | */ | 43 | */ |
| @@ -144,7 +161,7 @@ static int getfield (lua_State *L, const char *key, int d) { | |||
| 144 | 161 | ||
| 145 | 162 | ||
| 146 | static const char *checkoption (lua_State *L, const char *conv, char *buff) { | 163 | static const char *checkoption (lua_State *L, const char *conv, char *buff) { |
| 147 | static const char *const options[] = { LUA_STRFTIMEOPTIONS }; | 164 | static const char *const options[] = LUA_STRFTIMEOPTIONS; |
| 148 | unsigned int i; | 165 | unsigned int i; |
| 149 | for (i = 0; i < sizeof(options)/sizeof(options[0]); i += 2) { | 166 | for (i = 0; i < sizeof(options)/sizeof(options[0]); i += 2) { |
| 150 | if (*conv != '\0' && strchr(options[i], *conv) != NULL) { | 167 | if (*conv != '\0' && strchr(options[i], *conv) != NULL) { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luaconf.h,v 1.122 2009/12/17 12:26:09 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.123 2009/12/17 12:50:20 roberto Exp roberto $ |
| 3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -461,46 +461,6 @@ union luai_Cast { double l_d; long l_l; }; | |||
| 461 | 461 | ||
| 462 | /* }================================================================== */ | 462 | /* }================================================================== */ |
| 463 | 463 | ||
| 464 | |||
| 465 | /* | ||
| 466 | @@ LUA_STRFTIMEOPTIONS is the list of valid conversion specifiers | ||
| 467 | @* for the 'strftime' function; | ||
| 468 | ** CHANGE it if you want to use non-ansi options specific to your system. | ||
| 469 | */ | ||
| 470 | #if !defined(LUA_USE_POSIX) | ||
| 471 | #define LUA_STRFTIMEOPTIONS "aAbBcdHIjmMpSUwWxXyYz%", "" | ||
| 472 | |||
| 473 | #else | ||
| 474 | #define LUA_STRFTIMEOPTIONS "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%", "", \ | ||
| 475 | "E", "cCxXyY", \ | ||
| 476 | "O", "deHImMSuUVwWy" | ||
| 477 | #endif | ||
| 478 | |||
| 479 | |||
| 480 | |||
| 481 | /* | ||
| 482 | @@ lua_popen spawns a new process connected to the current one through | ||
| 483 | @* the file streams. | ||
| 484 | ** CHANGE it if you have a way to implement it in your system. | ||
| 485 | */ | ||
| 486 | #if defined(LUA_USE_POPEN) | ||
| 487 | |||
| 488 | #define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) | ||
| 489 | #define lua_pclose(L,file) ((void)L, pclose(file)) | ||
| 490 | |||
| 491 | #elif defined(LUA_WIN) | ||
| 492 | |||
| 493 | #define lua_popen(L,c,m) ((void)L, _popen(c,m)) | ||
| 494 | #define lua_pclose(L,file) ((void)L, _pclose(file)) | ||
| 495 | |||
| 496 | #else | ||
| 497 | |||
| 498 | #define lua_popen(L,c,m) ((void)((void)c, m), \ | ||
| 499 | luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) | ||
| 500 | #define lua_pclose(L,file) ((void)((void)L, file), -1) | ||
| 501 | |||
| 502 | #endif | ||
| 503 | |||
| 504 | /* | 464 | /* |
| 505 | @@ LUA_DL_* define which dynamic-library system Lua should use. | 465 | @@ LUA_DL_* define which dynamic-library system Lua should use. |
| 506 | ** CHANGE here if Lua has problems choosing the appropriate | 466 | ** CHANGE here if Lua has problems choosing the appropriate |
