aboutsummaryrefslogtreecommitdiff
path: root/liolib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-03-16 18:10:18 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-03-16 18:10:18 -0300
commit76492b4bb27a8695483449c433f4104df7b778ed (patch)
treee268e64c0fbff972c4e30371e2f0285dce8dccd5 /liolib.c
parent75250a237cb620ef44b344c07398b8a27bdcddc2 (diff)
downloadlua-76492b4bb27a8695483449c433f4104df7b778ed.tar.gz
lua-76492b4bb27a8695483449c433f4104df7b778ed.tar.bz2
lua-76492b4bb27a8695483449c433f4104df7b778ed.zip
macro 'lua_checkmode' + typos in comments
Diffstat (limited to 'liolib.c')
-rw-r--r--liolib.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/liolib.c b/liolib.c
index 2b4deb12..1f6f25b6 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 2.107 2011/11/14 16:55:35 roberto Exp roberto $ 2** $Id: liolib.c,v 2.108 2011/11/25 12:50:03 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*/
@@ -29,6 +29,14 @@
29#include "lualib.h" 29#include "lualib.h"
30 30
31 31
32#if !defined(lua_checkmode)
33
34/*
35** this macro can accept other 'modes' for 'fopen' besides the standard ones
36*/
37#define lua_checkmode(mode) 0
38
39#endif
32 40
33/* 41/*
34** {====================================================== 42** {======================================================
@@ -217,7 +225,7 @@ static int io_open (lua_State *L) {
217 if (!(mode[i] != '\0' && strchr("rwa", mode[i++]) != NULL && 225 if (!(mode[i] != '\0' && strchr("rwa", mode[i++]) != NULL &&
218 (mode[i] != '+' || ++i) && /* skip if char is '+' */ 226 (mode[i] != '+' || ++i) && /* skip if char is '+' */
219 (mode[i] != 'b' || ++i) && /* skip if char is 'b' */ 227 (mode[i] != 'b' || ++i) && /* skip if char is 'b' */
220 (mode[i] == '\0'))) 228 (mode[i] == '\0')) && !lua_checkmode(mode))
221 return luaL_error(L, "invalid mode " LUA_QS 229 return luaL_error(L, "invalid mode " LUA_QS
222 " (should match " LUA_QL("[rwa]%%+?b?") ")", mode); 230 " (should match " LUA_QL("[rwa]%%+?b?") ")", mode);
223 p->f = fopen(filename, mode); 231 p->f = fopen(filename, mode);