1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00

Ignore also cr's on input. This allows to compile sources with DOS/Windows

line separators on unix systems.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1419 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-09-30 19:32:33 +00:00
parent 15d2c8fc83
commit 1f20202239

View File

@ -383,11 +383,14 @@ int NextLine (void)
/* We got a new line */
++Input->Line;
/* Remove the trailing newline if we have one */
/* Remove the trailing cr/lf if we have one. We will ignore both, cr
* and lf on all systems since this enables us to compile DOS/Windows
* stuff also on unix systems (where fgets does not remove the cr).
*/
Part = strlen (line + Len);
Start = Len;
Len += Part;
while (Len > 0 && line [Len-1] == '\n') {
while (Len > 0 && (line[Len-1] == '\n' || line[Len-1] == '\r')) {
--Len;
}
line [Len] = '\0';