From b3b8dfaaea2dba7e7b4b898a5f767a80f36319f1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 17 Dec 2009 11:08:51 -0200 Subject: yet more options moved from luaconf.h into internal files --- liolib.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'liolib.c') diff --git a/liolib.c b/liolib.c index 767f7979..718058f2 100644 --- a/liolib.c +++ b/liolib.c @@ -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 -- cgit v1.2.3-55-g6feb