diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 11:08:51 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 11:08:51 -0200 |
commit | b3b8dfaaea2dba7e7b4b898a5f767a80f36319f1 (patch) | |
tree | d9dd2e8cbeb216f0bc61f1058946fbfcca120237 /liolib.c | |
parent | adc6a4865bfd12339ad7c31b43ba26206d385517 (diff) | |
download | lua-github-b3b8dfaaea2dba7e7b4b898a5f767a80f36319f1.tar.gz |
yet more options moved from luaconf.h into internal files
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.82 2009/09/01 19:10:48 roberto Exp roberto $ +** $Id: liolib.c,v 2.83 2009/11/24 12:05:44 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -19,6 +19,33 @@ #include "lualib.h" +/* +** lua_popen spawns a new process connected to the current one through +** the file streams. +*/ +#if !defined(lua_popen) + +#if defined(LUA_USE_POPEN) + +#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) +#define lua_pclose(L,file) ((void)L, pclose(file)) + +#elif defined(LUA_WIN) + +#define lua_popen(L,c,m) ((void)L, _popen(c,m)) +#define lua_pclose(L,file) ((void)L, _pclose(file)) + +#else + +#define lua_popen(L,c,m) ((void)((void)c, m), \ + luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) +#define lua_pclose(L,file) ((void)((void)L, file), -1) + +#endif + +#endif + + #define IO_INPUT 1 #define IO_OUTPUT 2 |