multiple input files feature now works again

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40412
This commit is contained in:
David Anderson 2007-01-29 06:43:27 +00:00
parent af651e15f3
commit 52b45354e8

View File

@ -170,6 +170,8 @@ static int *wqptr; /* pointer to next entry */
static HWND hwndFinish = 0;
#endif
char g_tmpfile[_MAX_PATH] = {0};
/* "main" of the compiler
*/
#if defined __cplusplus
@ -263,20 +265,22 @@ int pc_compile(int argc, char *argv[])
unsigned char tstring[128];
fsrc=(FILE*)pc_opensrc(sname);
if (fsrc==NULL) {
pc_closesrc(ftmp);
remove(tname);
strcpy(inpfname,sname); /* avoid invalid filename */
error(100,sname);
} /* if */
pc_writesrc(ftmp,(unsigned char*)"#file ");
pc_writesrc(ftmp,(unsigned char*)"#file \"");
pc_writesrc(ftmp,(unsigned char*)sname);
pc_writesrc(ftmp,(unsigned char*)"\n");
while (!pc_eofsrc(fsrc)) {
pc_readsrc(fsrc,tstring,sizeof tstring);
pc_writesrc(ftmp,(unsigned char*)"\"\n");
while (!pc_eofsrc(fsrc) && pc_readsrc(fsrc,tstring,sizeof tstring)) {
pc_writesrc(ftmp,tstring);
} /* while */
pc_closesrc(fsrc);
} /* for */
pc_closesrc(ftmp);
strcpy(inpfname,tname);
strcpy(g_tmpfile,tname);
free(tname);
} else {
strcpy(inpfname,get_sourcefile(0));
@ -481,9 +485,10 @@ cleanup:
} /* if */
#endif
if (g_tmpfile[0] != '\0') {
remove(g_tmpfile);
}
if (inpfname!=NULL) {
if (get_sourcefile(1)!=NULL)
remove(inpfname); /* the "input file" was in fact a temporary file */
free(inpfname);
} /* if */
if (litq!=NULL)