`popen' is not ANSI and therefore was removed from the basic library

This commit is contained in:
Roberto Ierusalimschy 2004-05-28 15:32:51 -03:00
parent c61bb89dba
commit e9844a4f1d
2 changed files with 2 additions and 32 deletions

View File

@ -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},

View File

@ -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