From 0079e0f57ce2bd4dc40b9b7c5831c58764a7938f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 3 Jun 2002 17:11:07 -0300 Subject: core tests whether file is binary --- lzio.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lzio.c') diff --git a/lzio.c b/lzio.c index 3e3610c9..fe0e18cd 100644 --- a/lzio.c +++ b/lzio.c @@ -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; -- cgit v1.2.3-55-g6feb