mirror of https://github.com/rusefi/lua.git
`popen' is not ANSI and therefore was removed from the basic library
This commit is contained in:
parent
c61bb89dba
commit
e9844a4f1d
22
liolib.c
22
liolib.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: liolib.c,v 2.50 2004/04/30 20:13:38 roberto Exp roberto $
|
||||
** $Id: liolib.c,v 2.51 2004/05/10 20:26:37 roberto Exp roberto $
|
||||
** Standard I/O (and system) library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -30,11 +30,6 @@
|
|||
*/
|
||||
|
||||
|
||||
#if !USE_POPEN
|
||||
#define pclose(f) (-1)
|
||||
#endif
|
||||
|
||||
|
||||
#define FILEHANDLE "FILE*"
|
||||
|
||||
#define IO_INPUT 1
|
||||
|
@ -148,20 +143,6 @@ static int io_open (lua_State *L) {
|
|||
}
|
||||
|
||||
|
||||
static int io_popen (lua_State *L) {
|
||||
#if !USE_POPEN
|
||||
luaL_error(L, "`popen' not supported");
|
||||
return 0;
|
||||
#else
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
const char *mode = luaL_optstring(L, 2, "r");
|
||||
FILE **pf = newfile(L);
|
||||
*pf = popen(filename, mode);
|
||||
return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int io_tmpfile (lua_State *L) {
|
||||
FILE **pf = newfile(L);
|
||||
*pf = tmpfile();
|
||||
|
@ -456,7 +437,6 @@ static const luaL_reg iolib[] = {
|
|||
{"close", io_close},
|
||||
{"flush", io_flush},
|
||||
{"open", io_open},
|
||||
{"popen", io_popen},
|
||||
{"read", io_read},
|
||||
{"tmpfile", io_tmpfile},
|
||||
{"type", io_type},
|
||||
|
|
12
luaconf.h
12
luaconf.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: luaconf.h,v 1.2 2004/05/10 13:58:26 roberto Exp roberto $
|
||||
** $Id: luaconf.h,v 1.3 2004/05/10 17:50:51 roberto Exp roberto $
|
||||
** Configuration file for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -258,16 +258,6 @@
|
|||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** by default, posix systems get `popen'
|
||||
*/
|
||||
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2
|
||||
#define USE_POPEN 1
|
||||
#else
|
||||
#define USE_POPEN 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue