sanitized asm file handling

SVN revision: 13925
This commit is contained in:
tsauerbeck 2005-03-26 16:44:12 +00:00 committed by tsauerbeck
parent b02572979a
commit 207ee341a7
3 changed files with 7 additions and 7 deletions

View File

@ -412,7 +412,7 @@ typedef struct __s_stringpair
/* output to intermediate (.ASM) file */ /* output to intermediate (.ASM) file */
void *sc_openasm(int fd); /* read/write */ void *sc_openasm(int fd); /* read/write */
void sc_closeasm(void *handle, int deletefile); void sc_closeasm(void *handle);
void sc_resetasm(void *handle); void sc_resetasm(void *handle);
int sc_writeasm(void *handle, char *str); int sc_writeasm(void *handle, char *str);
char *sc_readasm(void *handle, char *target, int maxchars); char *sc_readasm(void *handle, char *target, int maxchars);

View File

@ -220,12 +220,10 @@ sc_openasm(int fd)
} }
void void
sc_closeasm(void *handle, int deletefile) sc_closeasm(void *handle)
{ {
if (handle != NULL) if (handle != NULL)
fclose((FILE *) handle); fclose((FILE *) handle);
if (deletefile)
unlink(outfname);
} }
void void
@ -326,6 +324,8 @@ sc_compile(int argc, char *argv[])
if (fd_out < 0) if (fd_out < 0)
error(101, outfname); error(101, outfname);
unlink (outfname); /* kill this file as soon as it's (f)close'd */
setconfig(argv[0]); /* the path to the include files */ setconfig(argv[0]); /* the path to the include files */
lcl_ctrlchar = sc_ctrlchar; lcl_ctrlchar = sc_ctrlchar;
lcl_packstr = sc_packstr; lcl_packstr = sc_packstr;
@ -428,7 +428,7 @@ sc_compile(int argc, char *argv[])
assemble(binf, outf); /* assembler file is now input */ assemble(binf, outf); /* assembler file is now input */
} /* if */ } /* if */
if (outf != NULL) if (outf != NULL)
sc_closeasm(outf, TRUE); sc_closeasm(outf);
if (binf != NULL) if (binf != NULL)
sc_closebin(binf, errnum != 0); sc_closebin(binf, errnum != 0);

View File

@ -94,7 +94,7 @@ error(int number, ...)
if (sc_error(number, string, inpfname, start, fline, argptr)) if (sc_error(number, string, inpfname, start, fline, argptr))
{ {
sc_closeasm(outf, TRUE); sc_closeasm(outf);
outf = NULL; outf = NULL;
longjmp(errbuf, 3); longjmp(errbuf, 3);
} }
@ -109,7 +109,7 @@ error(int number, ...)
if (outf != NULL) if (outf != NULL)
{ {
sc_closeasm(outf, TRUE); sc_closeasm(outf);
outf = NULL; outf = NULL;
} /* if */ } /* if */
longjmp(errbuf, 2); /* fatal error, quit */ longjmp(errbuf, 2); /* fatal error, quit */