diff options
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 29 |
1 files changed, 28 insertions, 1 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 |