core tests whether file is binary

This commit is contained in:
Roberto Ierusalimschy
2002-06-03 17:11:07 -03:00
parent cfff013586
commit 0079e0f57c
5 changed files with 25 additions and 11 deletions

13
lzio.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lzio.c,v 1.16 2002/04/29 12:37:41 roberto Exp roberto $
** $Id: lzio.c,v 1.17 2002/06/03 17:46:34 roberto Exp roberto $
** a generic input stream interface
** See Copyright Notice in lua.h
*/
@@ -24,6 +24,17 @@ int luaZ_fill (ZIO *z) {
}
int luaZ_lookahead (ZIO *z) {
if (z->n == 0) {
int c = luaZ_fill(z);
if (c == EOZ) return c;
z->n++;
z->p--;
}
return *z->p;
}
void luaZ_init (ZIO *z, lua_Getblock getblock, void *ud, const char *name) {
z->getblock = getblock;
z->ud = ud;