aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-05-28 15:32:51 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-05-28 15:32:51 -0300
commite9844a4f1d8a4cb9642c00db552a40f65f3748b8 (patch)
treec50e34d66382e47b239f404ea5478899593796a6
parentc61bb89dbac0913cc28c775a58238403be75026f (diff)
downloadlua-e9844a4f1d8a4cb9642c00db552a40f65f3748b8.tar.gz
lua-e9844a4f1d8a4cb9642c00db552a40f65f3748b8.tar.bz2
lua-e9844a4f1d8a4cb9642c00db552a40f65f3748b8.zip
`popen' is not ANSI and therefore was removed from the basic library
-rw-r--r--liolib.c22
-rw-r--r--luaconf.h12
2 files changed, 2 insertions, 32 deletions
diff --git a/liolib.c b/liolib.c
index 916e5575..27f388ed 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 2.50 2004/04/30 20:13:38 roberto Exp roberto $ 2** $Id: liolib.c,v 2.51 2004/05/10 20:26:37 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*/
@@ -30,11 +30,6 @@
30*/ 30*/
31 31
32 32
33#if !USE_POPEN
34#define pclose(f) (-1)
35#endif
36
37
38#define FILEHANDLE "FILE*" 33#define FILEHANDLE "FILE*"
39 34
40#define IO_INPUT 1 35#define IO_INPUT 1
@@ -148,20 +143,6 @@ static int io_open (lua_State *L) {
148} 143}
149 144
150 145
151static int io_popen (lua_State *L) {
152#if !USE_POPEN
153 luaL_error(L, "`popen' not supported");
154 return 0;
155#else
156 const char *filename = luaL_checkstring(L, 1);
157 const char *mode = luaL_optstring(L, 2, "r");
158 FILE **pf = newfile(L);
159 *pf = popen(filename, mode);
160 return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
161#endif
162}
163
164
165static int io_tmpfile (lua_State *L) { 146static int io_tmpfile (lua_State *L) {
166 FILE **pf = newfile(L); 147 FILE **pf = newfile(L);
167 *pf = tmpfile(); 148 *pf = tmpfile();
@@ -456,7 +437,6 @@ static const luaL_reg iolib[] = {
456 {"close", io_close}, 437 {"close", io_close},
457 {"flush", io_flush}, 438 {"flush", io_flush},
458 {"open", io_open}, 439 {"open", io_open},
459 {"popen", io_popen},
460 {"read", io_read}, 440 {"read", io_read},
461 {"tmpfile", io_tmpfile}, 441 {"tmpfile", io_tmpfile},
462 {"type", io_type}, 442 {"type", io_type},
diff --git a/luaconf.h b/luaconf.h
index ebf4d170..7fb2f843 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.2 2004/05/10 13:58:26 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.3 2004/05/10 17:50:51 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -258,16 +258,6 @@
258#endif 258#endif
259 259
260 260
261/*
262** by default, posix systems get `popen'
263*/
264#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2
265#define USE_POPEN 1
266#else
267#define USE_POPEN 0
268#endif
269
270
271 261
272#endif 262#endif
273 263