From 3e429699792218af45a0f399542e14563c1a173b Mon Sep 17 00:00:00 2001 From: Luiz Henrique de Figueiredo Date: Mon, 26 Feb 1996 16:44:17 -0300 Subject: [PATCH] main always reads "luac.out" --- undump.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/undump.c b/undump.c index 3d7f3fe6..07714d9e 100644 --- a/undump.c +++ b/undump.c @@ -3,7 +3,7 @@ ** load bytecodes from files */ -char *rcs_undump="$Id: undump.c,v 1.3 1996/02/24 03:46:57 lhf Exp lhf $"; +char *rcs_undump="$Id: undump.c,v 1.4 1996/02/24 16:44:28 lhf Exp lhf $"; #include #include @@ -60,10 +60,10 @@ static TFunc *lastF=NULL; static void LoadFunction(FILE *D) { TFunc *tf=new(TFunc); - tf->size=LoadWord(D); + tf->size=LoadWord(D); /* TODO: Long? */ tf->marked=LoadWord(D); tf->lineDefined=LoadWord(D); - tf->fileName=LoadString(D); + tf->fileName=LoadString(D); /* TODO: not needed if not main */ tf->code=LoadBlock(tf->size,D); tf->next=NULL; if (tf->lineDefined==0) /* new main */ @@ -123,11 +123,13 @@ static void LoadChunk(FILE *D) int c=getc(D); if (c=='F') LoadFunction(D); else { ungetc(c,D); break; } } +#if 1 { /* TODO: run Main? */ TFunc *tf; for (tf=Main; tf!=NULL; tf=tf->next) PrintFunction(tf); } +#endif } void luaI_undump(FILE *D) @@ -143,6 +145,13 @@ void luaI_undump(FILE *D) int main(int argc, char* argv[]) { + FILE *f=freopen("luac.out","rb",stdin); + if (f==NULL) + { + fprintf(stderr,"undump: cannot open "); + perror("luac.out"); + exit(1); + } luaI_undump(stdin); return 0; }