aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-06-06 15:42:21 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-06-06 15:42:21 -0300
commit3ad03b331de36025a5daed76bc1984cc6288e6b4 (patch)
tree4fc66202a453fb0ec4a2af04492e4ad0bf62e5a0
parent86add535d8ee1936c8ff2e9e74e8024377e7b296 (diff)
downloadlua-3ad03b331de36025a5daed76bc1984cc6288e6b4.tar.gz
lua-3ad03b331de36025a5daed76bc1984cc6288e6b4.tar.bz2
lua-3ad03b331de36025a5daed76bc1984cc6288e6b4.zip
optional size for 'setvbuf'
-rw-r--r--liolib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/liolib.c b/liolib.c
index f80eff99..ed641a26 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 2.61 2005/05/25 13:21:26 roberto Exp roberto $ 2** $Id: liolib.c,v 2.62 2005/06/06 13:30:52 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*/
@@ -442,7 +442,9 @@ static int f_setvbuf (lua_State *L) {
442 static const char *const modenames[] = {"no", "full", "line", NULL}; 442 static const char *const modenames[] = {"no", "full", "line", NULL};
443 FILE *f = tofile(L); 443 FILE *f = tofile(L);
444 int op = luaL_checkoption(L, 2, NULL, modenames); 444 int op = luaL_checkoption(L, 2, NULL, modenames);
445 return pushresult(L, setvbuf(f, NULL, mode[op], 0) == 0, NULL); 445 lua_Integer sz = luaL_optinteger(L, 3, BUFSIZ);
446 int res = setvbuf(f, NULL, mode[op], sz);
447 return pushresult(L, res == 0, NULL);
446} 448}
447 449
448 450