Avoid spurious subsequent errors if an include file wasn't found.

git-svn-id: svn://svn.cc65.org/cc65/trunk@3908 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2009-01-18 15:07:55 +00:00
parent df341b6551
commit 30f88d2646
5 changed files with 47 additions and 13 deletions

View File

@@ -102,9 +102,14 @@ int MacPackFind (const StrBuf* Name)
void MacPackInsert (int Id)
/* Insert the macro package with the given id in the input stream */
{
int MacPackInsert (int Id)
/* Insert the macro package with the given id in the input stream. Returns
* true if the macro package was found and successfully inserted. Returns
* false otherwise.
*/
{
int RetCode;
/* Check the parameter */
CHECK (Id >= 0 && Id < MAC_COUNT);
@@ -116,6 +121,9 @@ void MacPackInsert (int Id)
/* Insert the builtin package */
NewInputData (MacPackages[Id].Package, 0);
/* Always successful */
RetCode = 1;
} else {
StrBuf Filename = AUTO_STRBUF_INITIALIZER;
@@ -127,12 +135,15 @@ void MacPackInsert (int Id)
SB_Terminate (&Filename);
/* Open the macro package as include file */
NewInputFile (SB_GetConstBuf (&Filename));
RetCode = NewInputFile (SB_GetConstBuf (&Filename));
/* Destroy the contents of Filename */
SB_Done (&Filename);
}
/* Return the success code */
return RetCode;
}