line separators on unix systems.
git-svn-id: svn://svn.cc65.org/cc65/trunk@1419
b7a2c559-68d2-44c3-8de9-
860c34a00d81
/* 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';