From: cuz Date: Fri, 20 Jan 2006 21:17:08 +0000 (+0000) Subject: Fixed a problem with files that don't end with a newline X-Git-Tag: V2.12.0~156 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=45ffbc59f5a2eae6faaf98570ea2c91685b68197;p=cc65 Fixed a problem with files that don't end with a newline git-svn-id: svn://svn.cc65.org/cc65/trunk@3697 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/input.c b/src/cc65/input.c index 7a18be365..21657cca9 100644 --- a/src/cc65/input.c +++ b/src/cc65/input.c @@ -147,7 +147,7 @@ static AFile* NewAFile (IFile* IF, FILE* F) * since we cannot use fileno() (non standard identifier in standard * header file), and therefore not fstat. When using stat with the * file name, there's a risk that the file was deleted and recreated - * while it was open. Since mtime and size are only used to check + * while it was open. Since mtime and size are only used to check * if a file has changed in the debugger, we will ignore this problem * here. */ @@ -437,14 +437,15 @@ int NextLine (void) /* Check for EOF */ if (C == EOF) { - /* Leave the current file */ - CloseIncludeFile (); - /* Accept files without a newline at the end */ if (SB_NotEmpty (Line)) { + ++Input->Line; break; } + /* Leave the current file */ + CloseIncludeFile (); + /* If there is no file open, bail out, otherwise get the * previous input file and start over. */